【问题标题】:CRM 2016 OrganizationServiceProxy.EnableProxyTypes seems to hangCRM 2016 OrganizationServiceProxy.EnableProxyTypes 似乎挂起
【发布时间】:2016-05-15 12:49:50
【问题描述】:

我们目前正在更改后端系统的架构,我们发现我们需要使用 OrganizationServiceProxy.EnableProxyTypes 方法启用代理类型以在 CodeActivities for Workflows 中使用。

但是,每当我包含此方法调用时,它都会使工作流在最终失败之前运行得非常慢。

这是我们用来调用该方法的代码:

    var service = serviceFactory.CreateOrganizationService(context.UserId);
    if (service is OrganizationService)
    {
        tracingService.Trace("Enabling proxy types");
        ((OrganizationServiceProxy)((OrganizationService)service).InnerService).EnableProxyTypes(assembly);
        tracingService.Trace("Proxy types enabled");
    }

有什么想法吗?

谢谢

【问题讨论】:

  • “我们发现我们需要启用代理类型以在 CodeActivities for Workflows 中使用”也许你想使用,但你肯定不需要

标签: dynamics-crm dynamics-crm-2016


【解决方案1】:

我从来不需要将程序集作为参数传递给 EnableProxyTypes。没有通过组装就试过了吗?

此外,还有另一种方法可以通过添加到 Behaviors 集合来启用代理类型。这是一个例子:

public static IOrganizationService GetOrganizationService(Guid userId)
{
    ClientCredentials credentials = new ClientCredentials();
    credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
    Uri homeRealmUri = null;

    using (OrganizationServiceProxy _serviceProxy = new OrganizationServiceProxy(new Uri(GetOrganizationUri()),
        homeRealmUri, credentials, null))
    {
        _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
        _serviceProxy.CallerId = userId;

        IOrganizationService _service = (IOrganizationService)_serviceProxy;
        return _service;
    }
}

【讨论】:

  • 您好,感谢您的回复,但我们决定采用不同的方式,因此不再适用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-06-19
  • 2021-06-02
  • 2012-08-08
  • 1970-01-01
  • 2013-03-11
  • 2014-04-22
  • 1970-01-01
相关资源
最近更新 更多