WcfService无法处理消息。这很可能是因为操作“http://tempuri.org/IService1/GetUserModel”不正确,或因为消息包含无效或过期的安全上下文令牌,或因为绑定之间出现不匹配。如果由于未处于活动状态导致服务中止了该通道,则安全上下文令牌无效。若要防止服务永久中止闲置会话,请增加服务终结点绑定上的接收超时。

解决方案 »

  1.   

    客户端能正常访问 wsdl 么?
      

  2.   

    <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
    <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
    <handlers>
    <remove name="WebServiceHandlerFactory-Integrated"/>
    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </handlers>
    </system.webServer>
    <system.serviceModel>
    <bindings>
       <wsHttpBinding>
        <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
         openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01: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="None">
          <transport clientCredentialType="Windows" proxyCredentialType="None"
           realm="" />
          <message clientCredentialType="Windows" negotiateServiceCredential="true"
           algorithmSuite="Default" establishSecurityContext="true" />
         </security>
        </binding>
       </wsHttpBinding>
      </bindings>
      <client>
       <endpoint address="http://localhost:9065/Service1.svc" binding="wsHttpBinding"
        bindingConfiguration="WSHttpBinding_IService1" contract="HsWcf.IService1"
        name="WSHttpBinding_IService1">
        <identity>
         <dns value="localhost" />
        </identity>
       </endpoint>
      </client>
      <services>
    <service name="ToPosWcf.Service1" behaviorConfiguration="ToPosWcf.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="" binding="wsHttpBinding" contract="ToPosWcf.IService1">
    <!-- 
                  部署时,应删除或替换下列标识元素,以反映
                  在其下运行部署服务的标识。删除之后,WCF 将
                  自动推导相应标识。
              -->
    <identity>
    <dns value="localhost"/>
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    </service>
    </services>
    <behaviors>
    <serviceBehaviors>
    <behavior name="ToPosWcf.Service1Behavior">
    <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点-->
    <serviceMetadata httpGetEnabled="true"/>
    <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息-->
    <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>
    </system.serviceModel>
      

  3.   

    你现在访问的wsdl地址是什么呢?是不是: http://localhost/[WebApplicationName]/mex?wsdl 呢?
      

  4.   

    GetUserModel 返回的是啥呢?可序列化吗?