问题描述
||
我们继承了在Visual Studio中运行的MVC 2应用程序,但是当我们尝试将其部署到生产服务器(Win 2008 x86)甚至同一台本地Win7 x64计算机上但使用IIS时,两者上的AppPool都是ASP.NET 4.0 w / Integrated模式,我们收到相同的NullReferenceException错误:
Server Error in \'/\' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more @R_730_4045@ion about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. @R_730_4045@ion regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.PipelineModuleStepContainer.GetEventCount(RequestNotification notification,Boolean isPostEvent) +30
System.Web.PipelinestepManager.ResumeSteps(Exception error) +266
System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context,AsyncCallback cb) +132
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context) +709
--------------------------------------------------------------------------------
Version @R_730_4045@ion: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
还有其他人经历过吗?任何建议表示赞赏。
谢谢!
解决方法
我想到的一个可能的原因是,应用程序托管在HttpContext在model1ѭ中不可用的集成模型中。因此,如果您的应用程序尝试访问HttpContext,Request,Response,则可能会抛出此错误。
,从tbe web.config中删除codedom标记,这将创建问题。 (我在VS 2017社区中遇到了这个问题
<system.codedom> </system.codedom>