CRM 2016 在线和 Azure 服务总线中继 - 50200:网关错误
CRM 2016 online and Azure Service Bus relay - 50200: Bad Gateway
我正在在线使用 Microsoft Dynamics CRM 2016 并尝试使用自定义工作流 activity 中的 Azure Service Bus relay。
我创建了一个自定义 activity(基于来自 CRM SDK 的 AzureAwareWorkflowActivity)并注册了一个端点(详情如下)。工作流执行结束并出现以下错误:
System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]:50200:网关错误,Resource:sb://****.servicebus.windows.net/update* ****。 TrackingId:b7681665-****
SystemTracker:NoSystemTracker, Timestamp:10/10/2016 2:15:45 下午(故障详细信息等于 Microsoft.Xrm.Sdk.OrganizationServiceFault)。
你知道如何解决这个问题吗?
工作流程activity
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; }
}
}
端点
问题已解决 - 原因是处理来自 CRM 的请求的服务主机配置不足。
原来从 CRM 发送的消息的大小超过了允许的大小。添加maxReceivedMessageSize是解决方案(2147483647可以改成更合理的值):
<bindings>
<ws2007HttpRelayBinding>
<binding name="default" maxReceivedMessageSize="2147483647">
</binding>
</ws2007HttpRelayBinding>
</bindings>
服务主机是基于 CRM SDK 中的 Two-way listener example 编写的。不幸的是,该示例不包含此配置。
我正在在线使用 Microsoft Dynamics CRM 2016 并尝试使用自定义工作流 activity 中的 Azure Service Bus relay。
我创建了一个自定义 activity(基于来自 CRM SDK 的 AzureAwareWorkflowActivity)并注册了一个端点(详情如下)。工作流执行结束并出现以下错误:
System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]:50200:网关错误,Resource:sb://****.servicebus.windows.net/update* ****。 TrackingId:b7681665-**** SystemTracker:NoSystemTracker, Timestamp:10/10/2016 2:15:45 下午(故障详细信息等于 Microsoft.Xrm.Sdk.OrganizationServiceFault)。
你知道如何解决这个问题吗?
工作流程activity
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; }
}
}
端点
问题已解决 - 原因是处理来自 CRM 的请求的服务主机配置不足。
原来从 CRM 发送的消息的大小超过了允许的大小。添加maxReceivedMessageSize是解决方案(2147483647可以改成更合理的值):
<bindings>
<ws2007HttpRelayBinding>
<binding name="default" maxReceivedMessageSize="2147483647">
</binding>
</ws2007HttpRelayBinding>
</bindings>
服务主机是基于 CRM SDK 中的 Two-way listener example 编写的。不幸的是,该示例不包含此配置。