【问题标题】:An error occurred while parsing the plugin profile from file从文件解析插件配置文件时出错
【发布时间】:2017-11-02 13:50:50
【问题描述】:

每当我将下载的错误日志文件上传到调试器时,我已将 CRM 与 CRM SDK 2016 的 插件注册工具 连接,它显示 “从文件解析插件配置文件时发生错误” 任何人都可以建议我哪里出错了。如下图所示:

ErrorImage

未处理的异常:System.ArgumentException:无法解析 OrganizationServiceFault。 参数名称:serializedReport 在 PluginProfiler.Library.ProfilerUtility.ExtractReport(字符串序列化报告) 在 PluginProfiler.Library.ProfilerUtility.DeserializeProfilerReport(字符串 assemblyFilePath,字符串 logFilePath,布尔 isCrmDataStream) 在 PluginProfiler.Library.ProfilerExecutionUtility.RetrieveReport(字符串 logFilePath,布尔 isCrmDataStream) 在 Microsoft.Crm.Tools.PluginRegistration.CommonControls.Helper.ParseReportOrShowError(窗口窗口,FileBrowserView profilePathControl,布尔 requireReportParse,ProfilerPluginReport& 报告) 内部异常:System.InvalidOperationException:消息不包含序列化值。 在 PluginProfiler.Library.ProfilerUtility.ExtractReportFromFault(OrganizationServiceFault 故障) 在 PluginProfiler.Library.ProfilerUtility.ExtractReport(String serializedReport)

除此之外,当下载日志文件时,它包含以下错误:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unexpected exception from plug-in (Execute): SamplePlugins.PostCreateContact: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.Detail: 
<OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <ActivityId>8998bfd9-9637-430e-8c47-998c63d1f0ee</ActivityId>
   <ErrorCode>-2147220956</ErrorCode>
   <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
   <Message>Unexpected exception from plug-in (Execute): SamplePlugins.PostCreateContact: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.</Message>
   <Timestamp>2017-11-03T11:49:06.9775603Z</Timestamp>
   <ExceptionRetriable>false</ExceptionRetriable>
   <ExceptionSource i:nil="true" />
   <InnerFault i:nil="true" />
   <OriginalException i:nil="true" />
   <TraceText>[SamplePlugins: SamplePlugins.PostCreateContact]
[e326c926-0dbe-e711-a94d-000d3af2242b: SamplePlugins.PostCreateContact: Create of contact (Profiled)]</TraceText>
</OrganizationServiceFault>

下面是我的 .CS 文件:

using Microsoft.Xrm.Sdk;
using System;

namespace SamplePlugins
{
    public class PostCreateContact : IPlugin
    {
        ITracingService tracingService;

        public void Execute(IServiceProvider serviceProvider)
        {
            tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
            tracingService.Trace("Tracing Execute");
            // Obtain the execution context from the service provider.
            IPluginExecutionContext context = (IPluginExecutionContext)
               serviceProvider.GetService(typeof(IPluginExecutionContext));
            // The InputParameters collection contains all the data
            //passed in the message request.
            if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
            {
                // Obtain the target entity from the input parameters.

                Entity entity = (Entity)context.InputParameters["Target"];
                try
                {
                    // Create a task activity to follow up with the account customer in 7 days
                    Entity followup = new Entity("task");
                    followup["subject"] = "Send e-mail to the new customer.";
                    followup["description"] = "Follow up with the customer. Check if there are any new issues that need resolution.";
                    followup["scheduledstart"] = DateTime.Now;
                    followup["scheduledend"] = DateTime.Now.AddDays(2);
                    followup["category"] = context.PrimaryEntityName;
                    // Refer to the contact in the task activity.
                    if (context.OutputParameters.Contains("id"))
                    {
                        Guid regardingobjectid = new Guid(context.OutputParameters["id"].ToString());
                        string regardingobjectidType = "contact";
                        followup["regardingobjectid"] = new EntityReference(regardingobjectidType, regardingobjectid);
                    }
                    // Obtain the organization service reference.
                    IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                    IOrganizationService service =
                       serviceFactory.CreateOrganizationService(context.UserId);
                    // Create the followup activity
                    service.Create(followup);
                }
                catch (Exception ex)
                {
                    throw new InvalidPluginExecutionException(ex.Message);
                }
            }
        }
    }
}

我已尝试更换 PluginProfiler.Solution.zip,但问题仍然存在。

谢谢。

【问题讨论】:

  • 在错误消息框中单击“是”并在此处获取实际异常并共享。
  • 首先按照@ArunVinoth 的建议去做,其次,您是在尝试调试插件还是注册插件?
  • 是的,我正在尝试调试模式并且我已经更新了问题。
  • 是的,我尝试替换那个 PluginProfile 解决方案,但仍然是同样的问题..

标签: dynamics-crm crm dynamics-crm-online dynamics-crm-365


【解决方案1】:

我推荐你以下步骤:

  1. 注销插件程序集和探查器
  2. 下载最新的365 SDK
  3. 使用最新 SDK 中的新 PRT 重新注册程序集
  4. 安装 Profiler 并重试
  5. 最重要的 - 您共享的错误日志不能用于使用 Profiler 进行调试。会有所不同

【讨论】:

    猜你喜欢
    • 2021-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-23
    • 2012-02-16
    • 2015-11-18
    • 1970-01-01
    相关资源
    最近更新 更多