ASP.NET MVC 2应用程序在VS中运行,但IIS上出现错误(ASP.NET MVC 2 app runs in VS but errors on IIS)

编程入门 行业动态 更新时间:2024-10-15 06:13:49
ASP.NET MVC 2应用程序在VS中运行,但IIS上出现错误(ASP.NET MVC 2 app runs in VS but errors on IIS)

我们继承了在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 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

有人经历过这个吗? 任何建议表示赞赏。

谢谢!

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:

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

Anyone else experienced this? Any advise is appreciated.

Thanks!

最满意答案

我能想到的一个可能原因是应用程序托管在集成模型中,HttpContext在Application_Start不可用。 因此,如果您的应用程序试图访问HttpContext,请求,响应,...它可能会抛出这个。

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.

更多推荐

System,Web,NET,NullReferenceException,error,电脑培训,计算机培训,IT培训"/> <m

本文发布于:2023-08-06 16:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1454476.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   出现错误   MVC   NET   ASP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!