could not load type MvcApplication on Global.asax - asp.net-mvc

I copied my MVC3 Razor website using FTP. However, when I type the URL I get an error:
"Could not load type Mynamespace.MvcApplication"
and it shows the problem is with Global.asax:
Line 1: <%# Application Codebehind="Global.asax.cs" Inherits="MvcPanamaVibes.MvcApplication" Language="C#" %>
My project runs fine on my computer. I tried by only uploading Global.asax and the rest but got the error. I uploaded Global.asax.cs as well but the problem persists.
If my application is fully compiled and runs fine on my computer, why is it complaining about this? what am I missing?

I encountered this problem, it was fixed when I rebuilt my MVC project on the server.

I was working using IIS Express, and tried with many solutions but none of them worked, after 2 days I found out 1 possible solution:
Copy dlls from release output folder, especially [project name].dll
Paste to debug output folder then run.

Related

Razor views not generating html after deploying Umbraco 7.2 in IIS 7

I am new to Umbraco, so I started creating a site to play a bit with it. While I had my site running on IIS express (either from VS or WebMatrix) everything worked fine. After deploying the site to IIS 7, the razor views of the front end are display in plain text, meaning that I actually see Razor syntax in the browser. Umbraco back office is working perfect though, except when I hit preview, in that case I get the plain Razor syntax again. I then try to deploy a simple new MVC project to IIS and the Razor engine worked just fine, so I guess is not a problem in IIS but in Umbraco configuration. Is there any configuration tweak I need to take care in Umbraco configuration to solve this problem? Thanks in advance for the help.
I also tried to deploy it in the IIS of my local development machine (the same in which it runs OK in IIS-express) which has the right framework and everything and I got the same cshtml display in the browser.
After struggling a bit more with the problem I found the issue causing this behavior. After installing the starter kit a lot of files are generated in the folder and subfolders of the solution. In order to publish the solution to generate the contents of your website the VS project needs to have all these files included as project files. I found out that some views were excluded of the project and thus not being generated when publishing. I included the missing views and double check that all important files were part of the project and problem solved.

MVC Page full of Unicode/Trash

I'm working on a web app project with a team which is currently being migrated from ASP.NET to ASP.NET MVC Framework, and late last week, I was suddenly unable to properly load any of the MVC pages.
I can load any page still on the old framework just fine. When I try to load one of the updated pages, I get something along the lines of this:
��}�s�6���[��wr�xj-��l��z<����W����NW>��lf(R!)d6�oHJM�e����)5�D�Fw��h4y����?>[��,{��?�-�9��Q�~�����ˣb6O��N��:.ˢ<5/#��#+�f�ų��^ϋ�~f�E^Ӽ~��:M�� �Jc:?�Y#X��o{��I��Z_��`���v�ُ�L�
The trash content fills the page, and is different every time. The results are the same in Chrome, Firefox, and Safari.
The Live Headers extension for Chrome shows that I'm getting a 500 error when this happens. In Internet Explorer (and Visual Studio Page Inspector, which I suspect is using IE to render the page), the error actually shows up instead of filling the page with trash:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 27: using System.Web.Routing;
Line 28: using System.Web.Script.Serialization;
Line 29: using Newtonsoft.Json;
Line 30: using Newtonsoft.Json.Converters;
Line 31:
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\7bd9a704\8efd3118\App_Web__layout.cshtml.639c3968.skqnufwa.0.cs Line: 29
Nobody else on my team is experiencing this issue. I have attempted:
Restarting Visual Studio
Rebooting my machine
Deleting all project files and re-downloading them from our version control
Replacing all files in C:/Windows/Microsoft.NET/Framework/v4.0.30319/ with a copy from one of my teammates who is not having this issue
Deleting all files in C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/
The project references Newtonsoft.Json.dll, which is located in $project_root/packages/Newtonsoft.Json.5.0.8/lib/net40, which I deleted and re-downloaded during my troubleshooting attempts.
I've pretty much been stuck working on SQL queries for the backend due to this problem (related question on dba.SE); I can certainly do the work and I have work to do, but I would like to be able to resolve this issue and be capable of contributing to any part of the project.
(So I'm copying a comment as an answer:)
Check if Newtonsoft.Json.dll is really located in /bin folder of your web application root after compilation.

Could not load file or assembly 'DotNetOpenAuth.Core'

I'm trying to implement OAuth in my existing MVC4 website. I had everything working in a test site, and everything was working fine on this particular site. I'm presently getting this error , but my web.config looks like this: . I tried this fix, I've tried GACing the components, I've tried uninstalling and re-installing the NuGet packages, I've tried clearing out the ASP.NET temp files, I honestly don't know what else to try... except maybe put my fist through my monitor.
Does anyone have any ideas? Thanks.
BTW, I solved the problem. It was because the project was upgraded from MVC 3, and I had the MVC 4 assembly in the list. Once I rebuilt the web.config from a new MVC4 project , the bindings stopped getting their wires crossed and the app started working again.
If you run into the same problem and want more details, reply here and I'll post them.

ASP MVC 2 with asp.net development server won't load default controller & action for an empty route

This used to work fine, but recently it refuse to load the default page for an empty route, instead it lists directory contents.
for example
http://localhost:1234/ should take me to the same page as http://localhost:1234/Home/Index assuming global.asax hasn't been modified, however recently it just takes me to "Directory List -- /" and lists out the content of the project folder.
This is using the ASP.NET Development Server. The sites work fine when deployed into IIS on a server.
Does anybody have any ideas, this is really annoying!
I would check the project settings like suggested on this other question:
Launching my debug MVC3 application opens a specific .cshtml file in the browser
Through trial and error I've determined that this is caused by the IBM RTC plug-in, when disabled it works normally.
I find this very surprising, but I've double checked and it is definitely that!

Should cs files be deployed when publishing an ASP.Net MVC application?

I have a project that compiles and runs fine on my development machine but when I run it on the web server I get the following error.
Parser Error Message: The file '/Views/Shared/Main.master.cs' does not exist.
The file mentioned does not exist on the server but the file '/Views/Shared/Main.master' does.
I use the 'Publish' command to upload the project. Is it missing the cs files?
Is there some setting where it does just in-time compiling that need to turn off?
I stumbled upon this solution.
The master page has the following attribute CodeFile="Main.master.cs". When I replaced this with CodeBehind="Main.master.cs" it works as expected.
The file originally came from an older web application but I don't know what the difference means. If someone else can come up with a better explanation I will accept their answer instead of this one.
Glad you got it figured out. It may come from an issue when converting from "Web Site" to "Web Application" project type.
http://aspadvice.com/blogs/ssmith/archive/2007/01/24/CodeFile-or-CodeBehind.aspx
Usually the files are marked with a reference to a dll that exists in the bin, e.g. App_Web_nnnnn in the inherits declaration of Main.master. Is that the case for that file on the web server and does the referenced dll exist in the bin? If not then it may not be pre-compiling as it should.
As far as I have seen with MVC, I don't think you even need the code-behind pages, do you?
I have removed the references from any pages in my app that were there for any reason.
Also, when you create a new View, I don't think it even creates the code-behind page in MVC, does it? (Really threw me to start with!!)

Resources