Error: «Could not load type MvcApplication»

后端 未结 30 1683
心在旅途
心在旅途 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:48

    I've seen this many times over the last decade and just had it again. There are many problems that result in the same error.

    One cause is a renaming of files. If you're working with .cshtml files, check all namespaces within those files and within the Views\web.config file. For web forms, rename Default.aspx (related .cs and designer files are automatically renamed). The codebehind changes but the Inherits line in the markup doesn't. Change it manually. Double check the designer page. Sometimes (VS2005-8?) the designer page doesn't reflect a change in the namespace. Haven't seen this in 2010+.

    Another issue is when it all works in VS or on your local PC but not when you deploy. This could be because the deployment environment isn't structured the same. For example, the error occurs if you place your code in a virtual directory under an application folder, but it doesn't occur if you create a new application folder and place all of your files in there. I don't understand this one, as I've had the new child/virtual folder set with the same permissions (or so I think) and (I believe) the application pool should work the same for everything in a given application folder.

    In my case I've also had a bin folder with assemblies that are updated from other assemblies on the IIS server. Again, ensuring that these are run in a separate application folder resulted in success.

    HTH

提交回复
热议问题