Dis*_*ile 5 c# asp.net-mvc azure-application-insights
我使用Visual Studio 2013 Update 4创建了一个新的ASP.net MVC应用程序,并选中了使用Application Insights的框。当我尝试运行应用程序时(无论是否调试),该站点永远都不会加载。当我调试它时,我注意到它被卡在Global.asax.cs中:
AreaRegistration.RegisterAllAreas();
Run Code Online (Sandbox Code Playgroud)
我查看了有关其他一些问题的答案,其中包括: AreaRegistration.RegisterAllAreas()未注册区域规则
这没有解决我的问题。我已经删除了此答案文件夹中的所有内容,并重新启动了Visual Studio,重新启动了我的PC,无论我做什么,此方法都会永远挂起。它似乎并不慢,因为我已经等待了5分钟以上,但还没有完成。还有其他人遇到这种情况吗?除了删除此呼叫以外,我该如何解决?
如果我注释掉Application Insights的Http模块注册,则该方法立即结束,但是一旦我将其重新添加,该方法就会再次挂起。AreaRegistration.RegisterAllAreas()调用和Application Insights似乎存在一些问题。
<httpModules>
<!-- removing this makes everything work -->
<!-- <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web" /> -->
</httpModules>
<modules>
<remove name="FormsAuthentication" />
<!-- removing these makes things work -->
<!--
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web" preCondition="managedHandler" />
-->
</modules>
Run Code Online (Sandbox Code Playgroud)
是的,我有同样的情况,我所做的是删除 appinsight 元素并在调试和发布 web.config 文件之间应用 xml 转换。当我想要调试并在发布时包含 appinsight 时,这对我很有帮助。
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web"
xdt:Transform="Insert"/>
</httpModules>
</system.web>
<system.webServer>
<modules>
<remove name="ApplicationInsightsWebTracking" xdt:Transform="Insert"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web" preCondition="managedHandler" xdt:Transform="Insert" />
</modules>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)