I've been tearing my hair out for about two days on this. I've read through and followed probably dozens of SO suggestions, and I'm still getting a parser error.
TL;DR:
We've tried dozens of things to rid our site of parser errors to no avail.
History:
We had a perfectly functional ASP.NET / JavaScript / AJAX website yesterday that our entire production floor uses for tracking circuit boards through the assembly process. I made a backup of it and deployed the UI changes and started getting errors. Copied the backup copy on top of the site and all was well (except the changes weren't deployed). I tried this several times, each time recovering with the backup.
Overnight, I thought about just creating a test site to deploy to, and instead of cutting & pasting as I'd done before, I used Web Publish in the VS 2010 IDE to the test site, which didn't work (it deployed just fine, but same or similar parser errors).
However...
Now, no matter what I do, the main production site is broken* for some reason, trying to replace the site with the backup no longer works, and we've spent the entire day so far trying to debug this. My co-worker is currently building a bare minimum site on the side to allow our production workers to scrape by while we sort this out.
What we've tried:
Pretty much every suggestion in this SO question, as well as this SO question, and this SO question. Probably a few more we've forgotten.
- We have deleted the test site from the webserver since both sites used the exact same name for the default.aspx file (not sure this was an issue, but since the production site our factory floor uses is nuked, there was no longer a need for the test site until we can get the production site up).
- We have deleted the \bin & \obj directories & rebuilt on both our dev boxes as well as made sure that the output path in the Build tab is set to: bin\
- The application runs just fine in debug / release on my Dev Box and my co-worker's box as well.
- We have deleted and recreated the web site on the IIS server multiple times.
- We have created a new website & deployed there (same issues).
- We have removed and recreated the Global.asax files from [Project] > Add > New Item > Global Application Class on both our dev boxes.
- We have recompiled dozens of times, shut down & restarted the IDE before & after recompilation (I can't see how this would make any difference, but it was suggested more than once).
- We have tried deploying from a different IDE / dev box.
- On the webserver, we've changed the Application pool back & forth between .NET 2.0 & .NET 4.0 (where it was when we started).
- We have tried renaming CodeBehind to CodeFile. (didn't work, same error).
- On the webserver, we've made sure the site was enabled in Directory Browsing (this seems to get toggled somehow, not sure why, but we sometimes get 404 errors which tells us it's toggled).
- On the webserver we've verified that IIS is using pass through authentication, and the application is using the global administrator for access and has all the permissions it needs.
- On the webserver all our other websites are still running fine.
- I'm sure I'm forgetting some things we've tried.
Environment:
WebServer: Server 2012 w/ IIS 8.5
Dev boxes: Windows 7 Pro 64bit, w/ VS 2010 / 2017 (not used in this scenario, but we have it).
Application: ASP.NET 3.5, using JavaScript, JQuery, AJAX on the front end, with C# [WebMethod]s on the back end talking to MariaDB (MySQL).
*Update:
My co-worker just finished the scrape-by-til-we-fix-it website, and is hitting the exact same parser problem. So now he's creating a WinForms app instead.
This leads me to believe there's a more global problem than we understand, but all our other websites on the same IIS server are still running just fine so it can't be server wide or they wouldn't work.
Actual error we're seeing:
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
Stack Trace:
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: