質問

基本認証を使用してサードパーティのWCFサービスを消費したいが、SNIも使用する必要があります。次の例(マイナスリアルエンドポイントスタッフ)をまとめて、私がセットアップしたものと私が得るエラーを表示しました。

私はWCFについてほとんど知らないと、SNIについては何も知っていません。

config

<endpoint 
 address="https://their.server.com/theirservice.svc"
 binding="basicHttpBinding"  
  bindingConfiguration="BasicHttpBinding_ISyncFramework2"
  contract="ISyncFramework" name="BasicHttpBinding_ISyncFramework2">
 </endpoint>

       <basicHttpBinding>
         <binding name="BasicHttpBinding_ISyncFramework2" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
       allowCookies="false" bypassProxyOnLocal="false" 
      hostNameComparisonMode="StrongWildcard"
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
           <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
               maxBytesPerRead="4096" maxNameTableCharCount="16384" />
           <security mode="Transport">
             <transport clientCredentialType="Basic" proxyCredentialType="None"
                 realm="" />
           </security>
         </binding>
       </basicHttpBinding>
.

コード:

            var service = new SyncFrameworkClient();
            service.ClientCredentials.UserName.UserName = "username";
            service.ClientCredentials.UserName.Password = "thepassword";

            service.method() // fails!
.

メソッドへの呼び出しは、次のようになります。

要求されたサービス、 'https://their.server.com/theirservice.svc'を起動できませんでした。詳細については、サーバーの診断トレースログを参照してください。

サーバトレース

Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
.
役に立ちましたか?

解決

そのエラーは通常、クライアント側の問題ではなくサービス側の問題です。SNIはSSLハンドシェイクを向上させるためのサーバーテクノロジであり、Microsoftスタックは未帰属IIS 8 バージョンでのみサポートされています。サードパーティが自分のSNI / SSLスタックをロールロールした場合を除き、WCFサービスがそれを必要とすることはほとんどないようです。

実際の例外では、このブログポストは、問題の原因になる可能性があります。ConfigとCode Snippetsは、SSLと基本的なHTTP認証を使用したBasichTTPBindingの権限を調べます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top