【问题标题】:Service running on another Service throw AggregateException in staging server (not in production)在另一个服务上运行的服务在登台服务器中抛出 AggregateException(不在生产​​中)
【发布时间】:2020-06-23 03:30:35
【问题描述】:

我们有服务

使用服务“UQPDF”(在服务器 cl-web1 中使用 https://abc/Html2Pdf.svc)更新(在 cl-app1 中运行的服务)

当我尝试发布具有相同内容但暂存版本的 RENEWAL 时
它在 cl-app2 中使用暂存服务“UQPDF”(在服务器 cl-web2 中使用 https://abc-staging/Html2Pdf.svc)

cl-app1 中的生产没有错误并调用 cl-web1 pdf 服务, 并且在本地运行以进行更新没有问题。 唯一的问题是当我使用 https://abc-staging/Html2Pdf.svc 在 app2 中发布它时。

它会抛出以下异常

System.AggregateException:发生一个或多个错误。 ---> System.InvalidOperationException:在 ServiceModel 客户端配置部分中找不到引用合同“EmailToPdf_Staging.IHtml2PdfService”的默认端点元素。这可能是因为找不到您的应用程序的配置文件,或者因为在客户端元素中找不到与此协定匹配的端点元素。

AppConfig 更新

  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IHtml2PdfService" maxBufferPoolSize="20000000"
          maxReceivedMessageSize="20000000" allowCookies="true">
          <readerQuotas maxDepth="32" maxStringContentLength="200000000"
            maxArrayLength="200000000" />
          <security mode="Transport">
            <transport clientCredentialType="None" />
            <message clientCredentialType="None" negotiateServiceCredential="false"
              establishSecurityContext="false" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://abc/Html2Pdf.svc"
        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHtml2PdfService"
        contract="EmailToPdf.IHtml2PdfService" name="WSHttpBinding_IHtml2PdfService" />
      <endpoint address="https://abc-staging/Html2Pdf.svc"
        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHtml2PdfService"
        contract="EmailToPdf_Staging.IHtml2PdfService" name="WSHttpBinding_IHtml2PdfService" />
    </client>
  </system.serviceModel>

UQPDF 网络配置

<system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IHtml2PdfService" closeTimeout="00:01:00" openTimeout="00:01:00"
                         receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false"
                         hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600"
                         messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="65536000" maxArrayLength="65536000" maxBytesPerRead="4096"
                                  maxNameTableCharCount="1638400" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
                    <security mode="Transport">
                        <transport clientCredentialType="None" />
                        <message clientCredentialType="None"
                                negotiateServiceCredential="false"
                                establishSecurityContext="false" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
        <services>
            <service name="Ubiquity.uSuite3.PdfServices.Html2PdfService" behaviorConfiguration="uqpdf.ServiceBehavior">
                <!-- Service Endpoints -->
                <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHtml2PdfService"
                          contract="Ubiquity.uSuite3.PdfServices.IHtml2PdfService" />
                <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="uqpdf.ServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>

【问题讨论】:

    标签: c# wcf wcf-binding


    【解决方案1】:

    我怀疑你的客户端没有通过你的配置文件找到你的合约,你可以参考我的配置。

    这是我的演示:

            <client>
                <endpoint address="http://localhost:8012/ServiceModelSamples/service"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
                    contract="Client4.IService1" name="BasicHttpBinding_Client4" />
                <endpoint address="http://localhost:8012/ServiceModelSamples/service"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
                    contract="Client2.IService1" name="BasicHttpBinding_Client2" />
            </client>
    

    这是endpoint的配置文件,建议不要将它们的名字设置成相同。

                ChannelFactory<Client4.IService1> Client4 = new ChannelFactory<Client4.IService1>("BasicHttpBinding_Client4");
                Client4.IService1 chanel4 = Client4.CreateChannel();
    
    
                ChannelFactory<Client2.IService1> Client2 = new ChannelFactory<Client2.IService1>("BasicHttpBinding_Client2");
                Client2.IService1 chanel2 = Client2.CreateChannel();
    

    我们根据不同的端点创建不同的通道来调用服务。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-18
      • 1970-01-01
      • 2023-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-17
      相关资源
      最近更新 更多