2012-04-13 57 views
3

我的Web服務將返回一個錯誤消息,不管我設置什麼樣的配置。我得到了以下錯誤消息。配置WCF客戶提供了「的消息無法處理的錯誤。這很可能是因爲動作

該消息無法處理,這很可能是因爲動作'http://tempuri.org/ITestingWebService/DoWork'不正確或 ,因爲該消息包含一個無效或過期的安全上下文 令牌或因爲有一個綁定之間不匹配如果服務由於 因服務中止而失去安全性,則安全 將無效VITY。防止服務中止空閒會話 過早地增加服務端點 綁定上的接收超時。

這裏是我的服務器&客戶web.config章節WCF。

服務器:

<system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="ConnectedStoreCCM.TestingWebServiceBehavior"> 
      <serviceMetadata httpGetEnabled="true" httpGetUrl="" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="WSHttpBinding_ITestingWebService" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" 
      sendTimeout="00:10:00" bypassProxyOnLocal="false" 
      transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
      messageEncoding="Text" textEncoding="utf-8" 
      useDefaultWebProxy="true" allowCookies="false" 
      maxReceivedMessageSize="2097152" maxBufferPoolSize="1024768"> 
      <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="None" /> 
       <message clientCredentialType="None" negotiateServiceCredential="false" 
         establishSecurityContext="false" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="ConnectedStoreCCM.TestingWebServiceBehavior" 
       name="ConnectedStoreCCM.TestingWebService"> 
      <endpoint 
       address="" 
       binding="wsHttpBinding" 
       contract="ConnectedStoreCCM.ITestingWebService"> 
      <identity> 
       <dns value="localhost" /> 
      </identity> 
      </endpoint> 
      <endpoint 
       address="mex" 
       binding="mexHttpBinding" 
       contract="IMetadataExchange" /> 
      <host> 
      <baseAddresses> 
       <add baseAddress="http://www.someuri.net/supertest/TestingWebService.svc?wsdl" /> 
      </baseAddresses> 
      </host> 
     </service> 
    </services> 
</system.serviceModel> 

客戶:

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="WSHttpBinding_ITestingWebService" closeTimeout="00:10:00" openTimeout="00:10:00" 
      receiveTimeout="00:10:00" sendTimeout="00:10:00" 
      bypassProxyOnLocal="false" transactionFlow="false" 
      hostNameComparisonMode="StrongWildcard" 
      messageEncoding="Text" textEncoding="utf-8" 
      useDefaultWebProxy="true" allowCookies="false" 
      maxBufferPoolSize="1024768" 
      maxReceivedMessageSize="2097152" > 
      <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="None" /> 
      <message clientCredentialType="None" negotiateServiceCredential="false" establishSecurityContext="false" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint name="WSHttpBinding_ITestingWebService" 
      address="http://www.someuri.net/supertest/TestingWebService.svc?wsdl" 
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ITestingWebService" 
      contract="ServiceReference1.ITestingWebService" > 
     <identity> 
      <dns value="localhost" /> 
     </identity> 
     </endpoint> 
    </client> 
</system.serviceModel> 

回答

0

你最有可能有ITestingWebService接口上的服務合同不匹配。嘗試右鍵單擊Visual Studio中的服務引用來運行「更新服務引用」,然後查看是否解決了該問題。

+0

感謝Sixto的建議,在我讀你之前我建議我認爲我找到了我的WCF部署問題的原因。 – user1212230 2012-04-13 20:05:25

+2

我自己找到了WCF服務引用問題的解決方案。這是配置元素設置的部署問題。我必須將ServiceMetaData標記externalMetadataLocation設置爲機器名稱和正確的URL。 svcutil返回了一個Web服務地址,例如http://ip-0aiquwe/Myservice.svc而不是http://www.mydomainname.net/Myservice.svc。當我設置externalMetadataLocaion =「http://www.mydomainname.net/Myservice.svc」;這一切對我來說都很好。 – user1212230 2012-04-13 20:11:47

相關問題