2015-07-10 44 views
0

我正嘗試將一個Web應用程序發佈到Azure中。它發佈成功,但遇到頁面時出現運行時錯誤。在發佈到Azure時註冊ApplicationInsights WebRequestTrackingModuleRegister時出錯

這裏是堆棧跟蹤:

[ArgumentNullException: Value cannot be null. 
Parameter name: moduleType] 
    System.Web.DynamicModuleRegistry.Add(Type moduleType) +304 
    System.Web.HttpApplication.RegisterModule(Type moduleType) +65 
    Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(Type moduleType) +36 
    Microsoft.ApplicationInsights.Extensibility.AzureWebSites.WebRequestTrackingModuleRegister.Register() +38 

[InvalidOperationException: The pre-application start initialization method Register on type Microsoft.ApplicationInsights.Extensibility.AzureWebSites.WebRequestTrackingModuleRegister threw an exception with the following error message: Value cannot be null. 
Parameter name: moduleType.] 
    System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +586 
    System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +129 
    System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +163 
    System.Web.Compilation.BuildManager.ExecutePreAppStart() +156 
    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +621 

[HttpException (0x80004005): The pre-application start initialization method Register on type Microsoft.ApplicationInsights.Extensibility.AzureWebSites.WebRequestTrackingModuleRegister threw an exception with the following error message: Value cannot be null. 
Parameter name: moduleType.] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +660 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +96 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189 

我不知道是什麼原因這一點。我只是爲App Insights for Web Applications添加nuget包,然後更新項目中包含的AppInsights.config文件中的InstrumentationKey。這些步驟與之前使用的步驟相同,但這次會產生這種奇怪的結果!

以前有人遇到過這個嗎?

回答

0

我在Azure上爲AppInsights設置第二個站點時遇到了同樣的問題。第一個網站是在幾個月前使用0.16.1-build00418版本(預發佈)安裝的,一切正常。就在今天,我使用版本1.1.0安裝了第二個Azure站點,並遇到了相同的錯誤。

雖然我不知道確切的原因,但我完全刪除了網站的內容,然後重新發布,從而解決了問題。

我知道如何完全刪除網站內容的唯一方法是通過FTP到網站。您可以通過從Azure門戶下載站點的發佈配置文件來獲取FTP連接信息。然後刪除/ site/wwwroot下的所有內容並重新發布。