22

のみを使用して、IIS で SSL と基本認証を使用して WCF サービスをセットアップすることは可能BasicHttpBinding-bindingですか?
(私は使えませんwsHttpBinding-binding)

このサイトは IIS 7 でホストされており、次の認証が設定されています。

  • 匿名アクセス:オフ
  • 基本認証:ON
  • 統合 Windows 認証:オフ

サービス構成:

<services>
  <service name="NameSpace.SomeService">
    <host>
      <baseAddresses>
        <add baseAddress="https://hostname/SomeService/" />
      </baseAddresses>

    </host>
    <!-- Service Endpoints -->
    <endpoint address="" binding="basicHttpBinding"
              bindingNamespace="http://hostname/SomeMethodName/1"
              contract="NameSpace.ISomeInterfaceService"
              name="Default"
                      />
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpsGetEnabled="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"/>
      <exceptionShielding/>
    </behavior>
  </serviceBehaviors>
</behaviors>

2 つの異なるエラーで2 種類のバインディングを試しました。

  • 1. IIS エラー:

    「バインディング BasicHttpBinding を持つエンドポイントのスキーム http に一致するベース アドレスが見つかりませんでした。登録されているベース アドレス スキームは [https] です。

    <bindings>
       <basicHttpBinding>
         <binding>
           <security mode="TransportCredentialOnly">
             <transport clientCredentialType="Basic"/>
           </security>
         </binding>
       </basicHttpBinding>
     </bindings>
    
  • 2. IIS エラー:

    このサービスのセキュリティ設定には「匿名」認証が必要ですが、このサービスをホストする IIS アプリケーションでは有効になっていません。

     <bindings>
       <basicHttpBinding>
         <binding>
           <security mode="Transport">
             <transport clientCredentialType="Basic"/>
           </security>
         </binding>
       </basicHttpBinding>
      </bindings>
    

これを正しく構成する方法を知っている人はいますか? (可能であれば?

4

1 に答える 1

25

掘り下げて数人の同僚に質問した後、最終的に問題を解決しました。

この場合、セキュリティには 2 つの側面があることを理解することが重要です。IIS セキュリティと WCF セキュリティ。

IIS セキュリティ: SSL を有効にし、基本認証を有効にします。匿名認証を無効にします。(もちろん、Windows アカウント/グループを作成し、IIS でアプリケーションにアクセス許可を設定します。)

WCF セキュリティ: バインディングは BasicHttpBinding のみであるため、サービスは何も有効にする必要はありません。IIS がこれを担当します。

サービスのバインディング構成:

<bindings>
  <basicHttpBinding>
     <binding>
        <security mode="Transport">
           <transport clientCredentialType="Basic" />
        </security>
     </binding>
  </basicHttpBinding>

最後に、最初のエラーを解決するために、mex エンドポイントを削除しました。このエンドポイントには HTTP バインディングが必要です。

削除:

<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
于 2010-05-28T06:32:53.347 に答える