簡體   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