1

我在線上使用Microsoft Dynamics CRM 2016,並嘗試使用自定義工作流程活動中的Azure Service Bus relayCRM 2016在線和Azure服務總線中繼 - 50200:錯誤的網關

我創建了一個自定義活動(基於來自CRM SDK的AzureAwareWorkflowActivity)並註冊了一個端點(詳情如下)。工作流程執行以下列錯誤結束:

System.ServiceModel.FaultException`1 [Microsoft.Xrm.Sdk.OrganizationServiceFault]:50200:Bad Gateway,Resource:sb://****.servicebus.windows.net /更新*****。 TrackingId:b7681665 - **** SystemTracker:NoSystemTracker,Timestamp: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

回答

0

問題解決 - 的原因是從CRM服務主機處理請求的構成不充分。

事實證明,從CRM發送的消息的大小比允許的大。添加maxReceivedMessageSize是解決方案(2147483647可以更改爲更合理的值):

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

服務主機是基於Two-way listener example從CRM SDK編寫的。不幸的是,該示例不包含此配置。