23

IIS で Windows 認証を有効にして匿名を無効に設定すると、次のエラーが発生します。

ホストで構成された認証スキーム ('IntegratedWindowsAuthentication') は、バインディング 'BasicHttpBinding' ('Anonymous') で構成されたものを許可しません。SecurityMode が Transport または TransportCredentialOnly に設定されていることを確認してください。さらに、この問題は、IIS 管理ツール、ServiceHost.Authentication.AuthenticationSchemes プロパティ、アプリケーション構成ファイル内のエレメント、バインディングの ClientCredentialType プロパティの更新、または調整によって、このアプリケーションの認証スキームを変更することによって解決される場合があります。 HttpTransportBindingElement の AuthenticationScheme プロパティ。

私のWcfサービスのweb.configは次のとおりです...

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpEndpointBinding"
        contract="Test.IService1" name="BasicHttpEndpoint" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceAuthenticationManager 
             authenticationSchemes="IntegratedWindowsAuthentication"/>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpBinding" scheme="http" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
         multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

ご意見をお聞かせください..

4

8 に答える 8

14

これを追加するとうまくいきました。

        <bindings>
        <webHttpBinding>
            <binding>
                <security mode="TransportCredentialOnly">
                    <transport clientCredentialType="Windows" />
                </security>
            </binding>
        </webHttpBinding>
    </bindings>
于 2014-10-31T21:39:51.560 に答える
2

.NET 4.0 から .NET 4.5.2 に更新するときに、このエラーが発生しました。clientCredentialType をから変更しました

<security mode="TransportCredentialOnly">
    <transport clientCredentialType="None"/>
</security>

<security mode="TransportCredentialOnly">
    <transport clientCredentialType="InheritedFromHost"/>
</security>

ただし、clientCredentialType="Windows" を設定しても同様にうまく機能します。

于 2016-10-21T11:18:39.423 に答える