WCF会话配置错误

时间:2013-06-19 07:48:46

标签: wcf wcf-data-services wcf-binding wcf-security

我想在我的服务中启用(SessionMode = SessionMode.Required),所以当我启用它然后使用WCF客户端测试测试服务时会引发以下错误:

无法处理邮件。这很可能是因为操作“http://schemas.xmlsoap.org/ws/2004/09/transfer/Get”不正确,或者因为邮件包含无效或过期的安全上下文令牌,或者因为绑定之间存在不匹配。如果服务因不活动而中止通道,则安全上下文令牌将无效。防止服务中止空闲会话过早增加服务端点绑定的接收超时.HTTP GET错误

URI: http://localhost:7645/PublisherService.svc    

HTML文档不包含Web服务发现信息。

<system.serviceModel>

    <bindings>
        <basicHttpBinding>
            <binding name="myBasicBinding"  maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="00:01:00" openTimeout="00:01:00" sendTimeout="00:01:00" receiveTimeout="00:01:00">
                <readerQuotas maxDepth="128" maxStringContentLength="8388608" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="2147483647"/>
            </binding>

        </basicHttpBinding>

   <!--enable WSHTTPBinding session-->
  <wsHttpBinding>
    <binding name="bindingAction" transactionFlow="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"  sendTimeout="00:01:00"   receiveTimeout="00:01:00" closeTimeout="00:01:00" openTimeout="00:01:00">
      <readerQuotas maxDepth="128" maxStringContentLength="8388608" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="2147483647"/>
      <reliableSession enabled="true"/>
      <security mode="Transport">
        <message establishSecurityContext="false" clientCredentialType="IssuedToken"/>
      </security>  
    </binding>
  </wsHttpBinding>

</bindings>

 <protocolMapping>
  <add scheme="http" binding="wsHttpBinding"/>
</protocolMapping>
<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
<services>
  <service name="AllChatService.PublisherService"  behaviorConfiguration="metadataSupport">    
    <host>
      <baseAddresses>
        <add baseAddress ="http://localhost:7645/"/>
      </baseAddresses>
    </host>
    <endpoint contract="AllChatService.PublisherService" binding="wsHttpBinding" address=""/>
    <!--Enable Meta Data Publishing-->
    <endpoint address="mex"  binding="mexHttpBinding"  contract="IMetadataExchange"/>
  </service>
</services>

 <behaviors>
    <serviceBehaviors>
    <behavior name="metadataSupport">
      <serviceDebug includeExceptionDetailInFaults="False" />

   <!--Enable WSDL Data Binding-->
      <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
    </behavior>
  </serviceBehaviors>


    </behaviors>

<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>




[ServiceBehaviorAttribute(InstanceContextMode = InstanceContextMode.PerCall)]
public class PublisherService : IPublisher
{
}

[ServiceContract(SessionMode = SessionMode.Required)]
public interface IPublisher
{
}

任何人都可以帮助我解决这个问题。

1 个答案:

答案 0 :(得分:0)

删除该行

<security mode="Transport">
来自您的web.config文件的

。因为传输似乎需要HTTPS来加密凭据。