Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果服务因WCF服务不活动而中止通道,则安全上下文令牌将无效_Wcf_Web Config - Fatal编程技术网

如果服务因WCF服务不活动而中止通道,则安全上下文令牌将无效

如果服务因WCF服务不活动而中止通道,则安全上下文令牌将无效,wcf,web-config,Wcf,Web Config,我目前正在尝试使用本地托管的网站访问托管的WCF服务,该网站正在服务器上成功运行(我能够访问wsdl等) 我得到一个错误: The message could not be processed. This is most likely because the action 'http://tempuri.org/IBetFriendService/SelectCustomerUsernamePasswordLogin' is incorrect or because the message co

我目前正在尝试使用本地托管的网站访问托管的WCF服务,该网站正在服务器上成功运行(我能够访问wsdl等)

我得到一个错误:

The message could not be processed. This is most likely because the action 'http://tempuri.org/IBetFriendService/SelectCustomerUsernamePasswordLogin' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.
我已将receiveTimeout和inactivityTimeout都增加到12:00:00,但仍然收到错误

Web配置:

<configuration>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IBetFriendService1" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="12:00: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="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="12:30:00"
            enabled="false" />
          <security mode="None">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://bet-friend.org.uk/BetFriendLibrary.BetFriendService.svc"
        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBetFriendService1"
        contract="BetFriendServiceReference2.IBetFriendService" name="WSHttpBinding_IBetFriendService1">
        <identity>
          <dns />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
</configuration>

WCF配置代码段:

  <system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
  <service name="BetFriendLibrary.BetFriendService">
    <endpoint address="" binding="wsHttpBinding" contract="BetFriendLibrary.IBetFriendService">
      <identity>
        <dns />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://bet-friend.org.uk/BetFriendLibrary.BetFriendService.svc" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="True"/>
      <serviceDebug includeExceptionDetailInFaults="False" />
     </behavior>
   </serviceBehaviors>
 </behaviors>
 </system.serviceModel>

我也遇到了同样的问题,一旦删除我的所有引用,我将再次创建。代码运行良好。。试试你也。。。祝你好运

谢谢


Ramesh Periyasamy

我已对此启用跟踪,现在出现以下错误:远程终结点发送了一个名称空间、名称发送者以及无法处理消息的原因的无法识别的错误。这很可能是因为操作“”不正确,或者是因为消息包含无效或过期的安全上下文令牌,或者是因为绑定之间不匹配。如果服务因不活动而中止通道,则安全上下文令牌将无效。您是否解决了此问题?