azure - CRM 2016 在线和 Azure 服务总线中继 - 50200 : Bad Gateway

标签 azure dynamics-crm azureservicebus dynamics-crm-2016 azure-servicebusrelay

我正在在线使用 Microsoft Dynamics CRM 2016 并尝试使用 Azure Service Bus relay来自自定义工作流程事件。

我创建了一个自定义事件(基于 CRM SDK 中的 AzureAwareWorkflowActivity)并注册了一个端点(详细信息如下)。工作流程执行结束并出现以下错误:

System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]:50200:错误网关,资源:sb://****.servicebus.windows.net/update*****。追踪编号:b7681665-**** SystemTracker:NoSystemTracker,时间戳:10/10/2016 2:15:45 PM(故障详细信息等于 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; }
    }
}

端点

Endpoint configuration

最佳答案

问题已解决 - 原因是处理来自 CRM 的请求的服务主机配置不足。

事实证明,从 CRM 发送的消息大小超出了允许的大小。添加maxReceivedMessageSize就是解决方案(2147483647可以改成更合理的值):

<bindings>
  <ws2007HttpRelayBinding>
    <binding name="default" maxReceivedMessageSize="2147483647">
    </binding>
  </ws2007HttpRelayBinding>
</bindings>

服务主机是根据Two-way listener example编写的来自 CRM SDK。不幸的是,该示例不包含此配置。

关于azure - CRM 2016 在线和 Azure 服务总线中继 - 50200 : Bad Gateway,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39961816/

相关文章:

Azure 服务总线共享访问签名

c# - 尝试连接到 Windows Azure 服务总线时出现 DNS 错误

azure - 窗口 Azure 模拟器 : Roles instances are taking longer than expected to start

json - 使用客户管理的 key 创建存储服务加密 ARM 模板

c# - 如何从 Azure BLOB 中的目录获取所有文件

javascript - 在 Dynamics 365 嵌入式 iframe Web 资源中使用加载微调器

javascript - CRM 2011 中的回复电子邮件事件图像

azure - AzCopy - .NET Framework 4.0

dynamics-crm - 具有不同数据的相似实体

c# - 如何访问 Azure Function 隔离进程中服务总线消息的 ApplicationProperties?