【发布时间】:2017-06-13 21:51:35
【问题描述】:
这两天我一直在扯头发。我已经阅读并遵循了可能数十条 SO 建议,但我仍然遇到解析器错误。
TL;DR:
我们已经尝试了很多方法来消除我们网站的解析器错误,但均无济于事。
历史:
昨天我们有一个功能完善的 ASP.NET / JavaScript / AJAX 网站,我们的整个生产车间都使用它来跟踪整个组装过程中的电路板。我对其进行了备份并部署了 UI 更改并开始出现错误。将备份副本复制到站点顶部,一切都很好(除了未部署更改)。我尝试了几次,每次都使用备份进行恢复。
一夜之间,我考虑创建一个要部署到的测试站点,而不是像以前那样剪切和粘贴,我在 VS 2010 IDE 中使用 Web Publish 到 测试站点 ,这不起作用(它部署得很好,但是相同或相似的解析器错误)。
不过……
现在,无论我做什么,主生产站点都因某种原因损坏*,尝试用备份替换站点不再有效,到目前为止,我们已经花了一整天的时间来调试它。我的同事目前正在旁边建立一个最低限度的站点,以便我们的生产工人在我们解决这个问题时勉强凑合。
我们的尝试:
SO question、as well as this SO question 和SO question 中的几乎所有建议。可能还有一些我们忘记了。
- 我们已经从网络服务器中删除了测试站点,因为两个站点都使用完全相同的名称作为 default.aspx 文件(不确定这是否是一个问题,但由于我们工厂车间使用的生产站点是 nuked,因此不再存在在我们建立生产站点之前需要测试站点)。
- 我们已删除 \bin 和 \obj 目录并在我们的两个开发箱上重新构建,并确保“构建”选项卡中的输出路径设置为:bin\
- 该应用程序在我的 Dev Box 和我同事的 Box 上调试/发布时运行良好。
- 我们在 IIS 服务器上多次删除并重新创建了该网站。
- 我们创建了一个新网站并在那里部署(同样的问题)。
- 我们已从两个开发箱的 [Project] > Add > New Item > Global Application Class 中删除并重新创建 Global.asax 文件。
- 我们已经重新编译了几十次,在重新编译之前和之后关闭并重新启动了 IDE(我看不出这会有什么不同,但建议不止一次)。
- 我们已尝试从不同的 IDE/开发盒进行部署。
- 在网络服务器上,我们在 .NET 2.0 和 .NET 4.0 之间来回更改了应用程序池(我们开始时的位置)。
- 我们已尝试重命名 CodeBehind to CodeFile.(没用,同样的错误)。
- 在网络服务器上,我们确保网站已在目录浏览中启用(这似乎以某种方式切换,不知道为什么,但我们有时会收到 404 错误,告诉我们它已切换)。
- 在网络服务器上,我们已经验证 IIS 正在使用 pass through 身份验证,并且应用程序正在使用全局管理员进行访问并且拥有它需要的所有权限。
- 在网络服务器上,我们所有其他网站仍然运行良好。
- 我确定我忘记了我们尝试过的一些事情。
环境:
WebServer:带 IIS 8.5 的 Server 2012
开发盒:Windows 7 Pro 64bit,带 VS 2010 / 2017(在此场景中未使用,但我们有)。
应用程序:ASP.NET 3.5,前端使用 JavaScript、JQuery、AJAX,后端使用 C# [WebMethod] 与 MariaDB (MySQL) 通信。
*更新:
我的同事刚刚完成了“scrape-by-til-we-fix-it”网站,并且遇到了完全相同的解析器问题。所以现在他正在创建一个 WinForms 应用程序。
这让我相信存在比我们理解的更全球性的问题,但我们在同一 IIS 服务器上的所有其他网站仍然运行良好,因此它不能在服务器范围内运行,否则它们将无法运行。
我们看到的实际错误:
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 'PCBIDRecord.Global'.
Source Error:
Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="PCBIDRecord.Global" Language="C#" %>
Source File: /global.asax Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1087.0
堆栈跟踪:
Event code: 3006
Event message: A parser error has occurred.
Event time: 6/13/2017 4:38:10 PM
Event time (UTC): 6/13/2017 11:38:10 PM
Event ID: 7effc328553b424c8f6005608ed8f11b
Event sequence: 1
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1/ROOT-1-131418706905858364
Trust level: Full
Application Virtual Path: /
Application Path: C:\inetpub\wwwroot\PCBClient\
Machine name: [REDACTED]
Process information:
Process ID: 1316
Process name: w3wp.exe
Account name: IIS APPPOOL\PCBClient
Exception information:
Exception type: HttpException
Exception message: Could not load type 'PCBIDRecord.Global'.
at System.Web.Compilation.BuildManager.ReportTopLevelCompilationException()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Compilation.BuildManager.CallAppInitializeMethod()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
Could not load type 'PCBIDRecord.Global'.
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp)
at System.Web.Compilation.BuildManager.CompileGlobalAsax()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
Could not load type 'PCBIDRecord.Global'.
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
Could not load type 'PCBIDRecord.Global'.
at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
Request information:
Request URL: http://[REDACTED]/
Request path: /
User host address: [REDACTED]
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\PCBClient
Thread information:
Thread ID: 6
Thread account name: IIS APPPOOL\PCBClient
Is impersonating: False
Stack trace: at System.Web.Compilation.BuildManager.ReportTopLevelCompilationException()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Compilation.BuildManager.CallAppInitializeMethod()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
Custom event details:
【问题讨论】:
-
我发现有时删除 bin 目录并部署新副本是可行的。我不知道这是否是您尝试过的。
-
是的,我们已经尝试过很多次了。
-
你能给我们看一个堆栈跟踪吗?
-
添加了堆栈跟踪,从底部的文本判断可能是身份验证错误?
-
通常我会说你缺少一个程序集。您是否验证了该程序集物理上(以数字方式?)存在于 bin 目录中?