Error: «Could not load type MvcApplication»

后端 未结 30 1461
心在旅途
心在旅途 2020-11-28 02:18

I am getting the error

Could not load type MvcApplication

when I try to run my website.

How to correct it?

相关标签:
30条回答
  • 2020-11-28 02:40

    As dumb as it might sound, tried everything and it did not work and finally restarted VS2012 to see it working again.

    0 讨论(0)
  • 2020-11-28 02:41

    My solution: Because I created the problem! I had changed the namespace in Global.asax.cs

    You also need to change the Inherits attribute value in the Global.asax.

    0 讨论(0)
  • 2020-11-28 02:43

    [Extracted from question]

    If you are getting this error: "Could not load type MvcApplication", look at the Output path of your project and make sure it is set to 'bin\'. The problem is that the AspNetCompiler cannot find the files if they are not in the default location.

    Another side effect of changing the output folder is that you will not be able to debug your code and it comes up with a message saying that the Assembly info cannot be found.

    0 讨论(0)
  • 2020-11-28 02:43

    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.

    0 讨论(0)
  • 2020-11-28 02:46

    Just do a manual build on your solution.

    If you are using local IIS try deleting the website registration in IIS manager and then recreating it manually.

    0 讨论(0)
  • 2020-11-28 02:46

    I had the same issue and solved it with below steps

    1. Go to project properties
    2. On the "Build' tab, set output path to "bin\"
    0 讨论(0)
提交回复
热议问题