gpt4 book ai didi

azure - 使用 Azure Application Insights 的 Dynamics CRM 365(在线)插件异常 EnvironmentPermission

转载 作者:行者123 更新时间:2023-12-03 03:08:26 24 4
gpt4 key购买 nike

我正在尝试使用插件和 Azure Application Insights 跟踪自定义事件。当我构建插件时,我使用 MSBuild.ILMerge.Task 将 Application.Insights.dll 与我的插件程序集合并。这是我的步骤接下来进行合并: http://dynamicscrmcoe.com/il-merge-dynamics-crm-plugins/

我遇到的问题是,当我尝试实例化遥测客户端时:

var telemetryClient = new TelemetryClient();

我收到此错误:

Request for the permission of type System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

我尝试使用安全属性授予权限:

[EnvironmentPermission(SecurityAction.Assert, Unrestricted = true)]

也尝试过

[PermissionSet(SecurityAction.Assert, Name = "FullTrust")]

但似乎没有任何效果。任何想法/建议将不胜感激。提前致谢。

最佳答案

简短的回答是你不能这样做。当前版本的 Application Insights 不支持对 CRM 沙盒插件施加的代码限制。

此问题已被报告并解决:https://github.com/Microsoft/ApplicationInsights-dotnet/issues/416 .

我下载了这段代码,它解决了它试图解决的问题,即某些机器信息调用。它仍然会抛出错误,因为它希望能够尝试读取文件系统 - 但它不能。

Application Insights 设计为在应用程序(通常但并非总是 Web 应用程序)的基础级别实现。您在创建自定义插件和工作流事件时编写的代码并不是该代码。它是基础级别应用程序的插件,并且该基础级别应用程序不实现 Application Insights。

也就是说,沙盒插件中没有太多必要使用 Application Insights。 Dynamics CRM 已经跟踪沙箱插件的插件执行统计信息,可以通过高级查找查看。

Advanced Find Search for Plugin Statistics

对于详细跟踪,尤其是异常跟踪,您可以在插件中使用 ITracingService

关于azure - 使用 Azure Application Insights 的 Dynamics CRM 365(在线)插件异常 EnvironmentPermission,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42101836/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com