Domanda

Vorrei consumare un servizio WCF di terze parti utilizzando l'autenticazione di base, ma ho anche bisogno di usare SNI.Ho hackerato insieme l'esempio seguente (meno roba di endpoint) per mostrare quello che ho configurato e l'errore che ottengo.

Qualsiasi aiuto molto apprezzato come so poco di WCF e nulla su 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>
.

Codice:

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

            service.method() // fails!
.

La chiamata a metodo non riesce con:

Il servizio richiesto, 'https://their.server.com/therservice.svc' non può essere attivato.Vedere i registri di traccia diagnostica del server per ulteriori informazioni.

La traccia del server

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)
.
È stato utile?

Soluzione

L'errore è solitamente un problema sul lato del servizio, non un problema lato client.SNI è una tecnologia del server per migliorare la handshaking SSL e in Microsoft Stack è supportata solo nella versione IIS 8 .A meno che la terza parte non ha rotolato il proprio stack SNI / SSL sembra improbabile che il loro servizio WCF lo richiederebbe.

Sull'eccezionale eccezione che stai ottenendo, sembra che qualcosa sulla parte posteriore di Questo post del blog sarebbe probabilmente la causa del problema.I tuoi frammenti di configurazione e codice sembrano giusti per Basichttpninding utilizzando SSL e Autenticazione HTTP di base.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top