Error: «Could not load type MvcApplication»

Viewed 208931

I am getting the error

Could not load type MvcApplication

when I try to run my website.

How to correct it?

43 Answers

I get this problem everytime i save a file that gets dynamically compiled (ascx, aspx etc). I wait about 8-10 seconds then it goes away. It's hellishly annoying.

I thought it was perhaps an IIS Express problem so I tried in the inbuilt dev server and am still receiving it after saving a file. I'm running an MVC app, i'm also using T4MVC, maybe that is a factor...

I had this frustrating error in development environment in Visual studio, and turned out the reason was quite dumb. In short if you have more than one web projects/sites in solution: make sure that the port you are trying to access the website is the same as configured in the Project Properties->Web

In my case, the error was caused because I was using a different port to access the website (in the browser) while the project in solution was assigned another port. To explain a little bit more, I had two website projects in my solution Website1(assigned port 8001 in ISS by Visual-Studio) and Website2(assigned port 8101 in ISS by Visual-Studio). So even though I was building Website1, I was trying to access the website using locahost:8101.

Now that I finally realized the problem, I see that @StingyJack's comment addresses the similar issue as well.

This happened to me because I added Global.asax.cs (C# file) to a VB.net project so the file didn't get compiled and I had to use a .vb version of the file for it to work and get compiled.

In my case the problem was that I changed the workspace name and the value apparently is case sensitive.

You have to check the action method, whether there is one or more methods when calling the method that overloads argumens or invalid argument enter image description here

public string test(string a, string b){

}

public ActionResult x(){
     test(a) //test is need two arguments
}

I had the same issue and what I did is to close my application and clean my temporary files and again rebuild the application. it worked for me :)

Related