我尝试用谷歌搜索这个问题并遵循了许多建议,例如替换 dll、重新安装 MVC3 等等。因此,我确实尝试接近这个非常棒的论坛,即使这个问题也很棘手。但我认为这个错误是普遍的,我想可能是由很多原因引起的。
问题:我使用 Visual Web Developer 2010 Express 制作了一个带有“Internet”模板的 asp.net MVC3 Web 应用程序。经过多次尝试,这次我将其称为“MvcAnotherTest”。它在我的本地机器上运行正常。我重新构建了解决方案并将这些文件复制到了 Windows Web Host 帐户服务器上的域根目录:
MvcAnotherTest.dll
Global.asax
Global.asax.cs (don't think that it needed but tried with it and without it).
Web.config
System.Web.Routing
System.Web.Mvc
System.Web.Abstractions
System.Web.Helpers
System.Web.WebPages
并且:
Microsoft.Web.Infrastructure
System.Web.Razor
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
但无论我做什么,当我尝试浏览该站点时,都会出现以下错误:
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'MvcAnotherTest.MvcApplication'.
Source Error:
Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="MvcAnotherTest.MvcApplication" Language="C#" %>
Source File: /global.asax Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034
我将 iis 配置为 7,将 asp.net 运行时配置为 4/4.5