Asp.net mvc 2 ASP.NET MVC 2应用程序在VS中运行,但在IIS上出错

Asp.net mvc 2 ASP.NET MVC 2应用程序在VS中运行,但在IIS上出错,asp.net-mvc-2,iis-7,iis-7.5,Asp.net Mvc 2,Iis 7,Iis 7.5,我们继承了在Visual Studio中运行的MVC 2应用程序,但当我们尝试将其部署到生产服务器(Win 2008 x86)或甚至同一台本地Win7 x64计算机上,但使用IIS时,两者上的AppPool都是ASP.NET 4.0 w/集成模式,我们会收到相同的NullReferenceException错误: Server Error in '/' Application. -------------------------------------------------------

我们继承了在Visual Studio中运行的MVC 2应用程序,但当我们尝试将其部署到生产服务器(Win 2008 x86)或甚至同一台本地Win7 x64计算机上,但使用IIS时,两者上的AppPool都是ASP.NET 4.0 w/集成模式,我们会收到相同的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 information 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. Information 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 Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 
还有其他人经历过吗?任何建议都将不胜感激


谢谢

我能想到的一个可能原因是应用程序托管在集成模型中,而HttpContext在
应用程序\u Start
中不可用。因此,如果您的应用程序尝试访问HttpContext、请求、响应。。。它可能会抛出此错误。

从tbe web.config中删除codedom标记,这就是创建issse。(我在VS 2017社区中遇到了这个问题

<system.codedom>    </system.codedom>


就是这样!谢谢!现在我想知道为什么heck HttpContext在IIS7上不可用…哦,好吧…:)我暂时在IIS6上托管了它。直到我们对Global.asax进行更改,允许它在IIS7集成模式下运行。再次感谢!