我在线使用Microsoft Dynamics CRM 2016并尝试使用自定义工作流程活动中的Azure Service Bus relay。
我创建了一个自定义活动(基于CRM SDK中的AzureAwareWorkflowActivity)并注册了一个端点(详情如下)。工作流程执行以以下错误结束:
System.ServiceModel.FaultException`1 [Microsoft.Xrm.Sdk.OrganizationServiceFault]:50200:Bad Gateway,Resource:sb://****.servicebus.windows.net/update*****。 TrackingId:b7681665 - **** SystemTracker:NoSystemTracker,时间戳:10/2016/2016下午2:15:45(故障细节等于Microsoft.Xrm.Sdk.OrganizationServiceFault)。
你知道如何解决这个问题吗?
工作流程活动
namespace Microsoft.Crm.Sdk.Samples
{
/// <summary>
/// This class is able to post the execution context to the Windows Azure
/// Service Bus.
/// </summary>
public class AzureAwareWorkflowActivity : CodeActivity
{
/// <summary>
/// This method is called when the workflow executes.
/// </summary>
/// <param name="executionContext">The data for the event triggering
/// the workflow.</param>
protected override void Execute(CodeActivityContext executionContext)
{
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IServiceEndpointNotificationService endpointService =
executionContext.GetExtension<IServiceEndpointNotificationService>();
endpointService.Execute(ServiceEndpoint.Get(executionContext), context);
}
/// <summary>
/// Enables the service endpoint to be provided when this activity is added as a
/// step in a workflow.
/// </summary>
[RequiredArgument]
[ReferenceTarget("serviceendpoint")]
[Input("Input id")]
public InArgument<EntityReference> ServiceEndpoint { get; set; }
}
}
端点
答案 0 :(得分:0)
问题解决了 - 原因是服务主机处理来自CRM的请求的配置不足。
事实证明,从CRM发送的邮件大小超过了允许的范围。添加maxReceivedMessageSize是解决方案(2147483647可以更改为更合理的值):
<bindings>
<ws2007HttpRelayBinding>
<binding name="default" maxReceivedMessageSize="2147483647">
</binding>
</ws2007HttpRelayBinding>
</bindings>
服务主机是基于CRM SDK中的Two-way listener example编写的。不幸的是,样本不包含此配置。