【发布时间】:2015-12-27 13:20:04
【问题描述】:
我正在尝试使用 Azure 预览门户中的 Application Insights 和 Visual Studio 2015 社区版。我遇到了三个不同的问题,我怀疑它们都是相关的。我想知道其他人是否遇到这些问题。
在我的一个测试网络应用程序中,App-Insight 工具部分工作。在另一个我收到有关不可恢复数据的错误。第三,当我将 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 输出窗口中显示了大量异常。我在这里包含了一个小的 sn-p,其中我用粗体显示了最有趣的两个部分:
抛出异常:Microsoft.ApplicationInsights.Extensibility.DependencyCollector.dll 中的“System.MethodAccessException” 抛出异常:Microsoft.ApplicationInsights.Extensibility.DependencyCollector.dll 中的“System.TypeInitializationException” 抛出异常:Microsoft.ApplicationInsights.Extensibility.DependencyCollector.dll 中的“System.TypeInitializationException” ApplicationInsightsHttpModule 初始化失败,出现异常:System.TypeInitializationException:“Microsoft.ApplicationInsights.Extensibility.DependencyCollector.Tracing.DependencyCollectorEventSource”的类型初始化程序引发异常。 ---> System.MethodAccessException:尝试通过方法“Microsoft.ApplicationInsights.Extensibility.DependencyCollector.Tracing.DependencyCollectorEventSource..ctor()”访问方法“Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.ApplicationNameProvider..ctor()”失败。
在 Microsoft.ApplicationInsights.Extensibility.DependencyCollector.Tracing.DependencyCollectorEventSource..ctor() 在 Microsoft.ApplicationInsights.Extensibility.DependencyCollector.Tracing.DependencyCollectorEventSource..cctor() --- 内部异常堆栈跟踪结束 --- 在 Microsoft.ApplicationInsights.Extensibility.DependencyCollector.DependencyTrackingTelemetryModule.Initialize(TelemetryConfiguration 配置) 在 Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.InitializeComponents(IEnumerable 组件,TelemetryConfiguration 配置) 在 Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.InitializeComponents(TelemetryConfiguration 配置) 在 Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.Initialize(TelemetryConfiguration 配置) 在 Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.get_Active() 在 Microsoft.ApplicationInsights.Extensibility.Web.ApplicationInsightsHttpModule..ctor()[msg=Log Error];[msg=System.TypeLoadException: 无法从程序集“Microsoft.ApplicationInsights,版本=1.2.0.5639,Culture=neutral,加载类型“Microsoft.ApplicationInsights.Channel.JsonSerializer”, PublicKeyToken=31bf3856ad364e35'。 在 Microsoft.ApplicationInsights.Extensibility.Web.Implementation.TelemetrySerializer.d__0.MoveNext() 在 System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine&stateMachine) 在 Microsoft.ApplicationInsights.Extensibility.Web.Implementation.TelemetrySerializer.SerializeAsync(IEnumerable
1 items) at Microsoft.ApplicationInsights.Extensibility.Web.Implementation.TelemetryBuffer.<>c__DisplayClass5.<FlushAsync>b__3() at System.Threading.Tasks.Task1.InnerInvoke() 在 System.Threading.Tasks.Task.Execute() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 Microsoft.ApplicationInsights.Extensibility.Web.Implementation.TelemetryBuffer.d__7.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 Microsoft.ApplicationInsights.Extensibility.Implementation.TaskTimer.c__DisplayClass1.d__3.MoveNext()]
我的 Azure 门户正在接收有关某些事物的遥测数据,但没有收到其他事物。简而言之,正如上述例外所暗示的那样,产生遥测的能力被削弱了。
现在解决下一个问题。
新建资源组
使用预览门户,我创建了一个名为“SandBox”的全新资源组。再次使用预览门户,然后我创建了一个名为“ScratchWeb”的全新 Web 应用程序,我将其分配给“沙盒”资源组。
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 资源集合中不可见。
现在最后一个问题...
原始资源组
如果我尝试在我的现有、默认网络应用资源组中创建一个新网站...那么上述问题都不会发生。不幸的是,我遇到了另一个问题。 “应用程序洞察力”资源刀片在尝试向我显示图表时告诉我“检索数据时出错”。另一方面,Visual Studio 告诉我一切都很好......它说的是“恭喜,你已经发布了你的第一个应用洞察数据。”
因此,最后,我只有一个具有可查看 App-Insight 结果的 Web 应用程序,而这些结果被削弱了。无论我是使用现有资源组还是尝试新资源组,我尝试使用 app-insight 创建第二个可运行的 Web 应用程序均未成功。
在 Visual Studio 2015 中,我使用了两种不同的方法来尝试添加 App-Insight SDK。我尝试事后将其添加到我的 Web 项目中,并且我还尝试从新项目模板中添加它。我让anything工作的唯一情况是,当我使用 App-Insight SDK “事后”检测我的第一个 Web 应用程序时。不幸的是(1)这些结果被削弱了,(2)正如我上面所描述的,我甚至无法第二次获得“瘫痪”的结果。因此,现在 App-Insight 功能对我来说是行不通的。
【问题讨论】:
-
仅供参考:您收到“组件已存在于不同的资源组中”消息,因为 Application Insights 资源名称在订阅中必须是唯一的。您不能在不同的资源组中拥有同名的项目,因此对于 AI,您要在 2 个地方创建同名的项目,这是不允许的。 (您已经在其他资源组中有一个 ScratchWeb)。基本上,AI 出于其目的而忽略资源组。
-
请将相关图片上传到 Stack Overflow 的 imgur - 由于显而易见的原因,本网站无法访问您 Gmail 帐户中的图片...
标签: c# asp.net azure visual-studio-2015 azure-application-insights