开发者

ASP.NET MVC 2 app runs in VS but errors on IIS

We inherited MVC 2 application that runs in Visual Studio but when we try to deploy it to production server (Win 2008 x86) or even the same local Win7 x64 machine but using IIS, AppPool on both is ASP.NET 4.0 w/ Integrated mode, we are getting the same NullReferenceException error:

    Se开发者_JAVA百科rver 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 

Anyone else experienced this? Any advise is appreciated.

Thanks!


One possible reason that I can think of is that an application is hosted in integrated model the HttpContext is not available in Application_Start. So if your application tries to access the HttpContext, Request, Response, ... it might throw this.


Remove the codedom tag from tbe web.config , it's create the issse. ( I faced this issue in VS 2017 Community

<system.codedom>    </system.codedom>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜