主机上的WCF服务连接超时

时间:2011-12-08 14:58:37

标签: c# .net winforms wcf .net-4.0

我有一个wcf服务并且在本地IIS上工作得很好但是当我将它部署到web时我得到连接超时错误。我将超时设置为10分钟并出现相同的错误。我还可以做些什么 ?超时是在客户端。

服务在Service Online

WCF Config file

   <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
    <services>
      <service behaviorConfiguration="LicenseServer.Service1Behavior" name="LicenseServer.Service1">
        <endpoint address="http://www.drorhan.com:8000" binding="wsHttpBinding" contract="LicenseServer.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        <host>
          <timeouts closeTimeout="00:1:00"/>
        </host>
      </service>
    </services>

客户端配置

<bindings>
  <wsHttpBinding>
    <binding name="WSHttpBinding_IService1" closeTimeout="00:10:00" openTimeout="00:10:00"
             receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false"
             hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
             messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096"
                    maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
      <security mode="Message">
        <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
        <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"
                 establishSecurityContext="true" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
  

服务器堆栈跟踪:konum:   System.ServiceModel.Security.IssuanceTokenProviderBase 1.DoNegotiation(TimeSpan timeout) konum: System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout) konum: System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) konum: System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) konum: System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout) konum: System.ServiceModel.Security.SecurityUtils.OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout) konum: System.ServiceModel.Security.SecurityUtils.OpenTokenProviderIfRequired(SecurityTokenProvider tokenProvider, TimeSpan timeout) konum: System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout) konum: System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) konum: System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) konum: System.ServiceModel.Security.SecurityProtocol.Open(TimeSpan timeout)
konum: System.ServiceModel.Channels.SecurityChannelFactory
{1.ClientSecurityChannel {1}} 1.ClientSecuritySessionChannel.OnOpen(时间跨度   超时)konum:   System.ServiceModel.Channels.CommunicationObject.Open(时间跨度   超时)konum:   System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
  konum:System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan   超时)konum:   System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel   频道,TimeSpan超时)konum:   System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(时间跨度   超时,CallOnceManager级联)konum:   System.ServiceModel.Channels.ServiceChannel.EnsureOpened(时间跨度   超时)konum:   System.ServiceModel.Channels.ServiceChannel.Call(String action,   Boolean oneway,ProxyOperationRuntime操作,Object [] ins,   对象[]出局,TimeSpan超时)konum:   System.ServiceModel.Channels.ServiceChannel.Call(String action,   Boolean oneway,ProxyOperationRuntime操作,Object [] ins,   对象[]出局)konum:   System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage   methodCall,ProxyOperationRuntime operation)konum:   System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天   消息)

更新

我从主机

中断连接10053错误

3 个答案:

答案 0 :(得分:2)

安全令牌协商有很多原因。

您是否在互联网环境中的邮件绑定中使用了窗口clientCredentialType。

Enable the WCF tracing可让您了解日志的更多细节。

答案 1 :(得分:0)

看来你在谈判中遇到了一些麻烦。有一个协商超时属性(http://msdn.microsoft.com/en-us/library/aa751788.aspx),但问题可能比简单的超时(防火墙可能)更深。

您是否尝试删除服务器端的以下部分:

 <identity>
    <dns value="localhost"/>
 </identity>

答案 2 :(得分:0)

第一个配置位是否是整个服务配置?

如果是这样,那可能就是你的问题所在。客户端中的每个超时配置设置都需要小于或等于服务中的配置设置。

如果您的服务没有定义这些超时,那么它会使用默认的超时,这可能不是您所期望的。仅仅在客户端定义它们是不够的。需要在两个地方定义它们。