3

設定した構成に関係なく、Web サービスがエラー メッセージを返します。次のエラー メッセージが表示されます。

メッセージを処理できませんでした。これは、アクション 'http://tempuri.org/ITestingWebService/DoWork' が正しくないか、メッセージに無効または期限切れのセキュリティ コンテキスト トークンが含まれているか、バインディング間に不一致があるためである可能性があります。非アクティブのためにサービスがチャネルを中止した場合、セキュリティ コンテキスト トークンは無効になります。サービスがアイドル セッションを途中で中止しないようにするには、サービス エンドポイントのバインディングで受信タイムアウトを早めに増やします。

これが私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>
4

1 に答える 1

0

インターフェイスにサービスコントラクトの不一致がある可能性がありITestingWebServiceます。Visual Studioでサービス参照を右クリックして「サービス参照の更新」を実行し、問題が解決するかどうかを確認してください。

于 2012-04-13T16:45:37.817 に答える