Impostare la protezione a livello di trasporto sul servizio WCF webHttp
Domanda
Sto cercando di impostare la sicurezza a livello di trasporto su un servizio WCF vincolante webHttp mia configurazione attuale si presenta così
<system.serviceModel>
<client>
<endpoint binding="webHttpBinding" bindingConfiguration="webHttp"
contract="PrimeStreamInfoServices.IService1" name="Client" />
</client>
<bindings>
<webHttpBinding>
<binding name="webHttp" maxBufferPoolSize="1500000" maxReceivedMessageSize="1500000" maxBufferSize="1500000">
<security mode="Transport">
<transport clientCredentialType="None"
proxyCredentialType="None"
realm="string" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="PrimeStreamInfoServices.Service1" behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttp" contract="PrimeStreamInfoServices.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PrimeStreamInfoServices.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
tuttavia quando ho eseguito il mio servizio io ottenere un'eccezione: Impossibile trovare un indirizzo di base che corrisponde https schema per l'endpoint con il legame webHttpBinding. schemi di indirizzo di base registrati sono [http].
Lo so im manca qualcosa, e ho cercato varie cose non posso capirlo, qualcuno ha qualche input su quello che ho da fare?
Soluzione
Sì - switch a HTTPS, con un certificato adeguato. sicurezza dei trasporti, nel caso di HTTP è fornito da un canale SSL. Non si può avere WS * la sicurezza dei trasporti su pianura HTTPS
Altri suggerimenti
Ignora la mia risposta precedente, stavo pensando WSHttpBinding non webHttpBinding.
E 'l'indirizzo che si utilizza per chiamare il servizio che deve iniziare con https.
Si può provare ad aggiungere un indirizzo di base (all'interno dell'elemento <host>
del servizio di configurazione), che è https? State aggiungendo una (o più) indirizzo di base (es) nel codice?
<service name="PrimeStreamInfoServices.Service1"
behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior">
<host>
<baseAddresses>
<add baseAddress="https://localhost:8080/YourService.svc" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<endpoint ......
</service>
Non sicuro al 100% se funziona con il webHttpBinding, ma fare un tentativo!
Marc
Ricordate che oltre il diritto di configurazione WCF, è inoltre necessario configurare IIS proprietà per abilitare SSL su di esso (compresa l'impostazione del certificato X.509 giusta per SSL). Il docs avere qualche informazione decente su come farlo.