繁体   English   中英

重启后:System.Web.PipelineStepManager.ResumeSteps中的NullReferenceException

[英]After reboot: NullReferenceException at System.Web.PipelineStepManager.ResumeSteps

(几乎)每天早上,在启动我的笔记本电脑,启动IIS,并在我的PC上浏览到特定的asp.net mvc Web应用程序后,我得到以下异常:

[NullReferenceException: Object reference not set to an instance of an object.]
   System.Web.PipelineStepManager.ResumeSteps(Exception error) +1781
   System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) +130
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +481

在iisreset之后,这个问题就解决了。 它只发生在我自己的笔记本电脑上,而不是在运行相同的asp.net mvc应用程序的舞台或现场服务器上

我已经检查过:

  • 我没有在global.asax中添加任何自定义事件处理程序
  • 我没有自己的自定义HTTPModules。 我确实使用ImageResizer,但没有为该模块定义事件处理程序(我知道并且可以在代码中看到)。
  • 我确实尝试将代码从Application_BeginRequest移动到global.Asax构造函数但遇到了另一个问题,因为在构造函数中我还没有任何HttpContext.Current。
  • (我知道NullReferenceException是什么意思,所以不需要解释它。在这种情况下,我的代码不会抛出异常。)

我在.net CLR版本4.0.30319上使用集成模式的应用程序池。目标框架是.Net 4.5.2

我的global.asax看起来像这样:

public class MvcApplication : HttpApplication {

        protected void Application_Start() {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            ModelBinders.Binders.Add(typeof(DateTime), new DateTimeModelBinder());
            ModelBinders.Binders.Add(typeof(DateTime?), new NullableDateTimeModelBinder());

            ClientDataTypeModelValidatorProvider.ResourceClassKey = "ValidationMessages";
            DefaultModelBinder.ResourceClassKey = "ValidationMessages";
        }

        protected void Application_BeginRequest(object sender, EventArgs e) {
            CultureInfo ci = new CultureInfo(LanguageHelpers.GetUserCultureName());
            System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
            System.Threading.Thread.CurrentThread.CurrentCulture = ci;
        }

        public void Application_Error(object sender, EventArgs e) {
            if (!Request.IsLocal) {

....

            }
        }
    }

在看了互联网上的错误后,我认为你有两个选择。

  1. 删除系统中添加的所有HTTP模块。
  2. 从控制面板中删除IIS - >程序和功能 - >关闭/打开窗口功能删除Internet信息服务并重新启动并重新安装。

看看这是否有效。

此外,您是否为任何其他项目收到此错误,或者创建新项目并检查出来? 如果是,那么可能重新安装IIS将解决这个问题。

服务器错误'/'应用程序。 - HttpException

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM