Server Error in '/' Application
.Unable to cast object of type 'System. Web.Compilation.BuildResultCompiledAssembly' to type 'System. Web.Compilation.BuildResultCompiledGlobalAsaxType
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the cod
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Compilation.BuildResultCompiledGlobalAsaxTyp`
:Source Err
.An unhandled excoption was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the excoption stack trace belo
:Stack Trace
[InvalidCastException: Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Compilation.BuildResultCompiledGlobalAsaxType'.]
System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +448
System.Web.Compilation.BuildManager.CompileGlobalAsax() +47
System.Web.Compilation.BuildManager. EnsureTopLevelFilesCompiled() +336
[HttpException (0x80004005): Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Compilation.BuildResultCompiledGlobalAsaxType'.]
System.Web.Compilation.BuildManager. ReportTopLevelCompilationException() +76
System.Web.Compilation.BuildManager. EnsureTopLevelFilesCompiled() +607
System.Web.Compilation.BuildManager.CallAppInitializeMethod() +33
System.Web.Hosting.HostingEnvironment. Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +865
[HttpException (0x80004005): Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Compilation.BuildResultCompiledGlobalAsaxType'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4690.
I recently added resx langauge packs to my asp.net application and during debug it build just fine and I can easily switch language but during production I get the above exception, I only get this when I publish to the server. After a couple of refreshes it goes away but it will come back usually after a day. I am publishing to an IIS server.
I have tried cleaning and rebuilding the application with a fresh bin folder to no avail.
UPDATE It was caused by "[assembly: AssemblyCulture("en-ZA")]" in the Assemblyinfo.cs, commmenting that out since the language culture works differently now solved the problem. I found the answer here :https://yurykorolev.blogspot.com/2007/10/localization-errors-in-aspnet.html
UPDATE
It was caused by "[assembly: AssemblyCulture("fr")]" in the Assemblyinfo.cs, commmenting that out made exception go away since the language culture works differently now. I found the answer here :https://yurykorolev.blogspot.com/2007/10/localization-errors-in-aspnet.html