webHttp WCFサービスにトランスポートレベルのセキュリティを設定します

StackOverflow https://stackoverflow.com/questions/1190251

  •  19-09-2019
  •  | 
  •  

質問

私は私の現在の設定は次のようになりますwebHttpバインディングWCFサービスのトランスポート・レベルのセキュリティを設定しようとしています。

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

私は私のサービスを実行すると、

しかし、私は例外を取得します: WebHttpBindingバインディングとエンドポイントのスキームのhttpsと一致するベースアドレスが見つかりませんでした。登録されたベースアドレススキームは、[HTTP]です。

私は何かが欠けてイム知っている、と私はそれを把握するカントいろいろなことをしようとしている、誰も私がしなければならないかについて、いくつかの入力を得たか。

役に立ちましたか?

解決

はい - 、適切な証明書を使用して、HTTPSに切り替えます。 HTTPの場合のトランスポートセキュリティは、SSLチャネルによって提供されます。あなたはプレーンなHTTPS経由でWS *トランスポート・セキュリティを設定することはできません。

他のヒント

私はwebHttpBindingないwsHttpBinding考えていた、私の以前の回答を無視します。

それはあなたがhttpsで始まる必要があり、サービスを呼び出すために使用するアドレスです。

ます。https://マシン名/ ServiceNameにする

あなたはHTTPSである(あなたのサービスの設定の<host>要素内)ベースアドレスを追加しようとすることはできますか?あなたは、コード内で(または複数)のベースアドレスを追加していますか?

<service name="PrimeStreamInfoServices.Service1" 
         behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior">
   <host>
      <baseAddresses>
         <add baseAddress="https://localhost:8080/YourService.svc" />
      </baseAddresses>
   </host>
   <!-- Service Endpoints -->
   <endpoint ......
</service>
それはwebHttpBindingで動作する場合は、

100%わからないが、それを試してみて!

マルク

右WCFの設定以外に、あなたはまた、(SSLのための右のX.509証明書の設定など)その上でSSLを有効にするには、IISのプロパティを設定する必要があることを忘れないでください。 ドキュメントには、それを行う方法についてのいくつかのまともな情報を持っています。

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