【问题标题】:Is my WCF using the correct Binding?我的 WCF 是否使用正确的绑定?
【发布时间】:2009-01-14 14:21:55
【问题描述】:

我的 wcf 服务的 web.config 如下所示:

我如何确认它使用的设置正确?

即使我已将绑定配置为使用,有时我仍然会收到此超时错误: SendTimeout = 10 分钟等?

<system.serviceModel>
    <services>
      <service behaviorConfiguration="MyService.MyServiceBehavior"
        name="MyService.MyService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="longTimeoutBinding"
          bindingName="" contract="MyService.IMyService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="longTimeoutBinding" closeTimeout="00:05:00" openTimeout="00:05:00"
          receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="1048576" maxReceivedMessageSize="67108864">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="MyService.MyServiceBehavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

我的客户端(Windows 服务)app.config 看起来像:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IMyService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="1048576" maxReceivedMessageSize="67108864"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://local/MyService/MyService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
        contract="MyService.IMyService" name="BasicHttpBinding_IMyService" />
    </client>
  </system.serviceModel>

【问题讨论】:

  • "有时我仍然会收到此超时错误..." 哪个超时错误?当您尝试连接时究竟发生了什么?您拥有客户吗?
  • 我拥有客户是的。我的错误日志显示如下错误消息:请求通道在 00:01:00 之后等待回复时超时 ...
  • 请同时发布您的客户端配置。
  • 特里,我也发布了客户端配置。看来我需要更改那里的设置....
  • 是的 - 尝试一下,如果可行,请告诉我们答案! :)

标签: wcf binding web-config


【解决方案1】:

如果你在客户端设置 sendTimeout 为 10 分钟呢?

【讨论】:

    【解决方案2】:

    尝试在客户端配置中设置超时值。

    【讨论】:

      猜你喜欢
      • 2012-04-05
      • 1970-01-01
      • 2014-11-04
      • 1970-01-01
      • 1970-01-01
      • 2010-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多