2011-11-10 13 views
2

私はWCF 4 RESTアプリケーションを複数の標準エンドポイント(ヘルプ機能用)を利用するように設定しようとしています。これは、私のホスティングIISプロセスに匿名認証とWindows認証の両方が有効になっているため、WCFアプリケーション内の特定のエンドポイントにどちらか一方が必要である(両方の例外が発生します)。WCF 4 REST - 認証のための複数の標準エンドポイント

<bindings> 
    <webHttpBinding> 
    <binding name="Anonymous"> 
     <security mode="None" /> 
    </binding> 

    <binding name="WindowsAuthentication"> 
     <security mode="TransportCredentialOnly"> 
     <transport clientCredentialType="Windows" /> 
     </security> 
    </binding> 
    </webHttpBinding> 
</bindings> 

そして、そのようなサービスを定義する:

以前、私はいくつかのバインディングを定義することによって、これを行うことができた

<services> 
    <service name="Host.SubscriberInfoHost"> 
    <endpoint address="" binding="webHttpBinding" bindingConfiguration="WindowsAuthentication" contract="Host.ISubscriberInfoHost" /> 
    </service> 
    <service name="Utilities.Instrumentation.ServiceStatus.ServiceStatusHost"> 
    <endpoint address="" binding="webHttpBinding" bindingConfiguration="Anonymous" contract="Utilities.Instrumentation.ServiceStatus.IServiceStatusHost" /> 
    </service> 
</services> 

これは私がこれまでに行うことを試みたものです

<standardEndpoints> 
     <webHttpEndpoint> 
      <standardEndpoint name="Host.SubscriberInfoHost" helpEnabled="true" automaticFormatSelectionEnabled="true"> 
       <security mode="TransportCredentialOnly"> 
       <transport clientCredentialType="Windows" /> 
       </security> 
      </standardEndpoint> 

      <standardEndpoint name="Utilities.Instrumentation.ServiceStatus.IServiceStatusHost" helpEnabled="true" automaticFormatSelectionEnabled="true"> 
       <security mode="None" /> 
      </standardEndpoint> 
     </webHttpEndpoint> 
    </standardEndpoints> 

ただし、これを行うとサービスが混乱する受け取る:

System.InvalidOperationException: IIS specified authentication schemes 'Negotiate, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used 

これはまさに私が逃げようとしているものです。誰かが、新しい標準のエンドポイントモデルを使ってこの状況をどのように設定するかについて、私に手を差し伸べることはできますか?ありがとう!

答えて

2

いくつかの実験の後、これに対する答えが見つかりました。標準エンドポイントの「名前」属性は、実際にはエンドポイント構成であることが分かります。だから、あなたは、次の標準的なエンドポイントを使用します。

<standardEndpoint name="WindowsAuthentication" helpEnabled="true" automaticFormatSelectionEnabled="true"> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows" /> 
      </security> 
</standardEndpoint> 

<standardEndpoint name="Anonymous" helpEnabled="true" automaticFormatSelectionEnabled="true"> 
      <security mode="None" /> 
</standardEndpoint> 

をそして、あなたはまた、そのような(「種類」以下と「endpointConfiguration」属性はこのエンドポイントを結ぶために設定する必要がありますように、サービスを構成します

<service name="SomeEndpoint"> 
    <endpoint address="" kind="webHttpEndpoint" endpointConfiguration="WindowsAuthentication" contract="ISomeEndpoint" /> 
    </service> 

これにより、便利なサービスヘルプページを維持しながら認証スタイルを混在させることができます。

+0

私が知る限り、1つのサービスでは1つの認証モードしか使用できません。これは機能しましたか? –

+0

これは私のために働いた、これは今までの年齢だったと思います。そして、.NET 3.5 –

関連する問題