首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Azure函数-应用程序洞察-自定义遥测- EventSource实例已存在

Azure函数-应用程序洞察-自定义遥测- EventSource实例已存在
EN

Stack Overflow用户
提问于 2017-07-25 08:39:18
回答 1查看 1.5K关注 0票数 5

我正在尝试遵循Insights Preview中的说明,在那里我可以创建自定义遥测。我完全按照指示去做。但也许我把它配置错了。

我在local.settings.json文件中设置了APPINSIGHTS_INSTRUMENTATIONKEY,它似乎工作得很好。但是当我添加一个新的TelemetryClient时,我开始得到那些重复的错误(如下所示)。它发生在函数被调用时。

我真的希望来自AF的遥测数据可以转到相同的AI仪表键,这样我就可以一起看到它。

我还拿出了Microsoft.Extensions.Logging,因为我只想使用AI,如果这有什么不同的话。

有人有什么建议吗?

见下文..。

提亚

代码语言:javascript
复制
ERROR: Exception in Command Processing for EventSource Microsoft-ApplicationInsights-Core: An instance of EventSource with Guid 74af9f20-af6a-5582-9382-f21f674fb271 already exists.
ERROR: Exception in Command Processing for EventSource Microsoft-ApplicationInsights-Core: An instance of EventSource with Guid 74af9f20-af6a-5582-9382-f21f674fb271 already exists.
Microsoft.WindowsAzure.ServiceRuntime Critical: 102 : Unexpcted Exception During Runtime Startup:
System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
 ---> System.Runtime.InteropServices.COMException: Invalid operation. (Exception from HRESULT: 0x80131022)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at <CrtImplementationDetails>.GetDefaultDomain()
   at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie)
   at <CrtImplementationDetails>.LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* )
   at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* )
   at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
   --- End of inner exception stack trace ---
   at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
   at .cctor()
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor()
ERROR: Exception in Command Processing for EventSource Microsoft-ApplicationInsights-Data: An instance of EventSource with Guid a62adddb-6b4b-519d-7ba1-f983d81623e0 already exists.
EN

回答 1

Stack Overflow用户

发布于 2017-07-25 11:25:00

我重新开始了一个新鲜的自动对焦项目(和一杯酒),以保持简单。

下面的代码可以工作:

代码语言:javascript
复制
private static TelemetryConfiguration config = new TelemetryConfiguration { InstrumentationKey = System.Environment.GetEnvironmentVariable("APPINSIGHTS_INSTRUMENTATIONKEY", EnvironmentVariableTarget.Process)};
private static TelemetryClient telemetryClient = new TelemetryClient(config);

这段代码(直接来自预览帖子)没有:

代码语言:javascript
复制
private static TelemetryClient telemetryClient = new TelemetryClient();
private static string key = TelemetryConfiguration.Active.InstrumentationKey = System.Environment.GetEnvironmentVariable("APPINSIGHTS_INSTRUMENTATIONKEY", EnvironmentVariableTarget.Process);

一个不幸的副作用是遥测不会自动显示在te VS2017应用程序洞察窗口中。你必须使用设置工具选择你想要的AI存储库,然后你就可以看到它了。几分钟后,但总比什么都没有好。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45292109

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档