我正在尝试使用Azure预览门户中的Application Insights和Visual Studio 2015社区版.我遇到了三个不同的问题,我怀疑这些问题都是相关的.我想知道其他人是否遇到这些问题.
在我的一个测试Web应用程序中,App-Insight工具部分正常工作.在另一个我收到有关无法挽回数据的错误.第三,当我将App-Insight与新资源组中的资源一起使用时,我遇到了部署失败.
我将在这个问题中提出这三个问题,因为我怀疑它们可能都有相同的根本原因.
部分结果
我尝试使用app-insight进行改造的第一个应用程序实际上可以工作并显示应用程序洞察遥测…或者至少它主要起作用.遥测数据的一半显示,其余的没有.
设置的顺序如下:
我从2015年6月开始安装sample Mobile-MVC app that came with this MSDN Magazine article.在摆弄添加引导程序以制作响应式页面之后,我决定将代码提交到VS在线GIT,然后部署为Azure Web应用程序.
然后我按照View logs in Application Insights的说明运行了应用程序,该应用程序成功启动了浏览器并允许我与该站点进行交互.但是,在本练习中,我在Visual Studio输出窗口中显示了大量异常.我在这里添加了一个小片段,在这里我加入了最有趣的两个部分:
Exception thrown: ‘System.MethodAccessException’ in Microsoft.ApplicationInsights.Extensibility.DependencyCollector.dll
Exception thrown: ‘System.TypeInitializationException’ in Microsoft.ApplicationInsights.Extensibility.DependencyCollector.dll
Exception thrown: ‘System.TypeInitializationException’ in Microsoft.ApplicationInsights.Extensibility.DependencyCollector.dll
ApplicationInsightsHttpModule failed at initialization with exception: System.TypeInitializationException: The type initializer for ‘Microsoft.ApplicationInsights.Extensibility.DependencyCollector.Tracing.DependencyCollectorEventSource’ threw an exception. —> System.MethodAccessException: Attempt by method ‘Microsoft.ApplicationInsights.Extensibility.DependencyCollector.Tracing.DependencyCollectorEventSource..ctor()’ to access method ‘Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.ApplicationNameProvider..ctor()’ failed.
at Microsoft.ApplicationInsights.Extensibility.DependencyCollector.Tracing.DependencyCollectorEventSource..ctor()
at Microsoft.ApplicationInsights.Extensibility.DependencyCollector.Tracing.DependencyCollectorEventSource..cctor()
— End of inner exception stack trace —
at Microsoft.ApplicationInsights.Extensibility.DependencyCollector.DependencyTrackingTelemetryModule.Initialize(TelemetryConfiguration configuration)
at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.InitializeComponents(IEnumerable components, TelemetryConfiguration configuration)
at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.InitializeComponents(TelemetryConfiguration configuration)
at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.Initialize(TelemetryConfiguration configuration)
at Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.get_Active()
at Microsoft.ApplicationInsights.Extensibility.Web.ApplicationInsightsHttpModule..ctor()[msg=Log Error];[msg=System.TypeLoadException: Could not load type ‘Microsoft.ApplicationInsights.Channel.JsonSerializer’ from assembly ‘Microsoft.ApplicationInsights, Version=1.2.0.5639, Culture=neutral, PublicKeyToken=31bf3856ad364e35’.
at Microsoft.ApplicationInsights.Extensibility.Web.Implementation.TelemetrySerializer.d__0.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.ApplicationInsights.Extensibility.Web.Implementation.TelemetrySerializer.SerializeAsync(IEnumerable1 items)
1.InnerInvoke()
at Microsoft.ApplicationInsights.Extensibility.Web.Implementation.TelemetryBuffer.<>c__DisplayClass5.<FlushAsync>b__3()
at System.Threading.Tasks.Task
at System.Threading.Tasks.Task.Execute()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ApplicationInsights.Extensibility.Web.Implementation.TelemetryBuffer.d__7.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ApplicationInsights.Extensibility.Implementation.TaskTimer.<>c__DisplayClass1.<b__0>d__3.MoveNext()]
我的Azure门户正在接收某些东西的遥测,但没有其他东西.简而言之,如上述例外情况所示,产生遥测的能力已经削弱.
现在为下一个问题.
新资源组
使用预览门户,我创建了一个名为“SandBox”的全新资源组.再次使用预览门户,我创建了一个名为“ScratchWeb”的全新Web应用程序,我将其分配给“Sandbox”资源组.
Web资源的部署最终完成,但是有一个关联的应用程序洞察资源称为“”Microsoft.WebSite3cb98c31-893c“”,它自动创建,在最终被声明为失败的部署之前会遇到十几个超时错误.下面我展示了一个超时错误的示例,以及提供一些关键信息的最终错误.
Operation Id
1E2094CECE6531F1
Tracking Id
31283062-9061-4dcf-bd42-f9885abbf596
Status
GatewayTimeout
Provisioning State
Running
Timestamp
9/28/2015 10:37:59 PM
Duration
PT30.7117477S
Type
microsoft.insights/components
Resource Id
/subscriptions/da769a1f-78d8-4d45-b9b3-c15ea0c89ca2/resourceGroups/SandBox/providers/microsoft.insights/components/ScratchWeb
StatusMessage
{"code":"GatewayTimeout","message":"Request timed out","innererror":{"diagnosticcontext":"034b642f-aece-494b-9ede-f8b015f5bfeb","time":"2015-09-29T05:37:59.8355234Z","data":"d0fe44bb-8317-4359-bf2c-160f1eb00433"}}
Resource
ScratchWeb
这是最终失败错误消息:
Operation Id
1E2094CECE6531F1
Tracking Id
08dbbf0a-0d4a-4692-9b1a-3603a984d40d
Status
Conflict
Provisioning State
Failed
Timestamp
9/28/2015 10:48:16 PM
Duration
PT10M47.5300298S
Type
microsoft.insights/components
Resource Id
/subscriptions/da769a1f-78d8-4d45-b9b3-c15ea0c89ca2/resourceGroups/SandBox/providers/microsoft.insights/components/ScratchWeb
StatusMessage
{"code":"The component already existed in a different resource group.","message":"The component already existed in a different resource group.","innererror":{"diagnosticcontext":"9ea42d3d-4dbf-46e8-a188-eac09a4ddb09","time":"2015-09-29T05:48:15.7282268Z"}}
Resource
ScratchWeb
这是因为“Application Insights”预览不能在多个资源组中运行,还是因为我的订阅不允许它?
最奇怪的部分是,一旦app-insights资源的部署最终失败,它似乎已经创建,并且在我的Application Insights资源集合中不可见.
现在最后一个问题……
原始资源组
如果我尝试在现有的默认Web应用程序资源组中创建新网站…则不会出现上述问题.不幸的是我遇到了另一个问“应用程序洞察”资源刀片在尝试向我显示图表时告诉我“检索数据错误”.另一方面,Visual Studio告诉我一切都很好……它说的是“祝贺你,你已经发布了第一个应用洞察数据.”
因此,最后,我只有一个Web应用程序具有可查看的App-Insight结果,并且这些结果已经瘫痪.无论我是使用现有资源组还是尝试使用新资源组,我尝试使用app-insight创建第二个有效的Web应用程序都是不成功的.
在Visual Studio 2015中,我使用了两种不同的方法来尝试添加App-Insight SDK.事后我尝试将它添加到我的web项目中,我也尝试从新的项目模板中添加它.我得到任何工作的唯一情况是,当我使用App-Insight SDK“事后”检测我的第一个Web应用程序时.不幸的是(1)那些结果被削弱了(2)正如我上面所描述的那样,我再也无法达到“残缺”的结果.因此,现在App-Insight功能对我来说是行不通的.
解决方法:
尝试删除对Application Insights的所有引用,清理项目.然后添加NuGet包Microsoft.ApplicationInsights.Web,目前版本为1.2.1.
PM> Install-Package Microsoft.ApplicationInsights.Web
这将安装所有必需的依赖项.安装完成后,在订阅中创建Application Insights资源(按照Add Application Insights SDK to monitor your ASP.NET app中的说明操作),并将Instrumentation键添加到您的应用中.我建议将instrumentation键放在web.config设置中:
<appSettings>
<add key="AppInsightsInstrumentationKey" value="your-key-value" />
</appSettings>
并将其添加到Application_Start中的应用程序,如:
TelemetryConfiguration.Active.InstrumentationKey = ConfigurationManager.AppSettings["AppInsightsInstrumentationKey"] ?? "some-default-key";
更新—
还有更多故障排除信息here.
>如果未记录浏览器事件:
>如果浏览器客户端前面有防火墙,则可能必须打开TCP端口80和443以获取到dc.services.visualstudio.com和f5.services.visualstudio.com的传出流量.
>在浏览器开发人员工具中,在网络选项卡上查找“track”条目 – 它应该将数据发布到https://dc.services.visualstudio.com/v2/track(或fc ……)
>如果服务器数据未记录:
>通过Azure Portal安装应用程序洞察:浏览到您的WebApp>>工具>>扩展,然后安装Application Insights扩展.
原文地址:https://codeday.me/bug/20190519/1136618.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。