IIS的连接做多只能维持2分钟,这个是默认设置,可以修改,是建站点的时候设置的,自己去找找。另外你的错误就是超时产生的,我也遇到过超时错误,也是给的这样的信息。

解决方案 »

  1.   

    你好谢谢你的回答
    我的是挂在windowsservice上的...
      

  2.   


    我也设置了.都是设置的receive时间为30分钟. 我把server和client的APP都发给你看下.
    Server:
     <system.web>
        <compilation debug="true" />
      </system.web>
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="ADHelperBehavior">
              <serviceMetadata httpGetEnabled="true"  />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <services>
          <service name="Diodes.BPMService.ADHelper"  behaviorConfiguration="ADHelperBehavior">
            <endpoint address="" contract="Diodes.BPMService.BPMInterface.IADHelper" binding="wsHttpBinding"  />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://nb1212009:9999/ADHelper" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <bindings>
          <wsHttpBinding>
            <binding name="wsHttpBindingConfiguration" maxReceivedMessageSize="20971510">
              <readerQuotas maxStringContentLength="20971520" maxArrayLength="20971520"/>
              <security mode="None" />
            </binding>
          </wsHttpBinding>
          <basicHttpBinding>
            <binding name="ADServiceSoap" closeTimeout="00:05:00" openTimeout="00:05:00"
                receiveTimeout="00:40:00" sendTimeout="00:40:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                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>
      </system.serviceModel>
    Client:
     <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="ADServiceSoap" closeTimeout="00:05:00" openTimeout="00:05:00"
              receiveTimeout="00:30:00" sendTimeout="00:30:00" allowCookies="false"
              bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
              maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
              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>
          <wsHttpBinding>
            <binding name="WSHttpBinding_IADHelper" closeTimeout="00:05:00"
              openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:30:00"
              bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
              maxBufferPoolSize="524288000" maxReceivedMessageSize="65536000"
              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" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://nb1212009:9999/ADHelper" binding="wsHttpBinding"
            bindingConfiguration="WSHttpBinding_IADHelper" contract="wcfADService.IADHelper"
            name="WSHttpBinding_IADHelper">
            <identity>
              <servicePrincipalName value="host/NB1212009.sh.bcd.com" />
            </identity>
          </endpoint>
        </client>
      </system.serviceModel>
      

  3.   

    你的终结点使用的是wsHttpBinding协议,并未用到basicHttpBinding协议,看了下你的超时设置,你改的是那个没有用到的basicHttpBinding协议下面的设置,改错了。建议你直接把那个basicHttpBinding节点删除,完全多余,兵重新设置wsHttpBinding协议的超时设置(服务端你用的还是默认超时)
      

  4.   

    好的,我把Basic的拿掉,wshttp的加上时间试一下。
      

  5.   


    还是这样...
    Server:
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="ADHelperBehavior">
              <serviceMetadata httpGetEnabled="true"  />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <services>
          <service name="Diodes.BPMService.ADHelper"  behaviorConfiguration="ADHelperBehavior">
            <endpoint address="" contract="Diodes.BPMService.BPMInterface.IADHelper" binding="wsHttpBinding"  />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://nb1212009:9999/ADHelper" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <bindings>
          <wsHttpBinding>
            <binding name="WSHttpBinding_IADHelper" closeTimeout="00:01:00"
              openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
              bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
              maxBufferPoolSize="524288000" maxReceivedMessageSize="65536000"
              messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
              allowCookies="false">
              <readerQuotas maxStringContentLength="20971520" maxArrayLength="20971520"/>
              <security mode="None" />
            </binding>
          </wsHttpBinding>
        </bindings>
      </system.serviceModel>Client:
      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="WSHttpBinding_IADHelper" closeTimeout="00:01:00"
              openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
              bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
              maxBufferPoolSize="524288000" maxReceivedMessageSize="65536000"
              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" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://nb1212009:9999/ADHelper" binding="wsHttpBinding"
            bindingConfiguration="WSHttpBinding_IADHelper" contract="wcfADService.IADHelper"
            name="WSHttpBinding_IADHelper">
            <identity>
              <servicePrincipalName value="host/NB1212009.sh.bcd.com" />
            </identity>
          </endpoint>
        </client>
      </system.serviceModel>
      

  6.   


    当然重启了...我现在知道具体错误了,但是不知道问题在哪。
    就是我的执行时间超过10分钟就会报这个错.但是我的超时时间,inactivetimeout,线程数都设了,还是不行,快绝望了.
      

  7.   

    那你再仔细检查客户端的代码,我怀疑你客户端并未使用配置文件来连接。不然怎么会不报错呢?
    服务端的安全设置:<security mode="None" />
    客户端的安全设置:<security mode="Message">
    仅凭这点就不可能正常工作。然后是服务端的绑定设置,缺少了bindingConfiguration="WSHttpBinding_IADHelper",不指定绑定名的情况下,也许会找个默认的,我没有验证过,反正我都是会指定具体绑定设置对应名的。综合看来你的思路很乱,估计部分设置走的是代码而非配置文件,结果问题倒底出在哪里都不清楚了。
      

  8.   

    服务端的安全设置:<security mode="None" />
    客户端的安全设置:<security mode="Message">
    我将客户端的安全设置改成 None,直接不能运行,报错.
    无法处理消息。这很可能是因为操作“http://tempuri.org/IADHelper/SyncADUserInfo”不正确,或因为消息包含无效或过期的安全上下文令牌,或因为绑定之间出现不匹配。如果由于未处于活动状态导致服务中止了该通道,则安全上下文令牌无效。若要防止服务永久中止闲置会话,请增加服务终结点绑定上的接收超时。我的客户端代码很简单啊. 四行...
    wcfADService.ADHelperClient wcfService = new wcfADService.ADHelperClient();
    wcfService.Open();
    wcfService.SyncADUserInfo();
    wcfService.Close();是在不行 我把代码发给你可以帮忙看看吗?
      

  9.   


    你好,谢谢你  找到原因了 就是你说的 没指定bindingConfiguration.
    感谢!!!提前祝您新春愉快~~~