Pergunta

Estou tentando definir a segurança nível de transporte em um webHttp ligação de serviço WCF meus atuais aparência de configuração como esta

 <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>

No entanto, quando eu executar o meu serviço eu recebo uma exceção: Não foi possível encontrar um endereço base que corresponde esquema https para o endpoint com WebHttpBinding vinculativo. esquemas de endereço base registada sejam [http].

Eu sei im faltando alguma coisa, e eu tenho tentado várias coisas que eu não consigo descobrir isso, alguém tem algumas informações sobre o que eu tenho que fazer?

Foi útil?

Solução

Sim - mudar para HTTPS, um certificado adequado. segurança dos transportes, no caso de HTTP é fornecido por um canal SSL. Você não pode ter WS * a segurança do transporte sobre plain HTTPS

Outras dicas

Ignorar a minha resposta anterior, eu estava pensando wsHttpBinding não WebHttpBinding.

É o endereço que você usa para chamar o serviço que deve começar com https.

https: // machineName / ServiceName

Você pode tentar adicionar um endereço de base (dentro do elemento <host> de sua configuração do serviço), que é https? Você está adicionando um (ou vários) endereço base (es) em código?

<service name="PrimeStreamInfoServices.Service1" 
         behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior">
   <host>
      <baseAddresses>
         <add baseAddress="https://localhost:8080/YourService.svc" />
      </baseAddresses>
   </host>
   <!-- Service Endpoints -->
   <endpoint ......
</service>

Não 100% de certeza se isso funciona com o webHttpBinding, mas experimentá-lo!

Marc

Lembre-se que, além da configuração WCF direita, você também precisa configurar o IIS propriedade para habilitar SSL sobre ele (incluindo a configuração do certificado X.509 certo para SSL). A docs tem alguma informação decente sobre como fazê-lo.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top