仅限windows身份验证的IIS7上WCF服务上的wsHttpBinding

仅限windows身份验证的IIS7上WCF服务上的wsHttpBinding,wcf,.net-3.5,iis-7,Wcf,.net 3.5,Iis 7,在IIS7上拥有托管的WCF服务.net 3.5sp1,并具有运行应用程序池的域帐户。我想关闭windows身份验证、wsHttpBinding和匿名。已删除mex终结点,设置消息安全性,但仍获得: 此服务的安全设置需要“匿名”身份验证,但未为承载此服务的IIS应用程序启用此身份验证 我已经尝试了大约50种不同的web.config配置,但没有乐趣 当前web.config: <system.serviceModel> <behaviors> &l

在IIS7上拥有托管的WCF服务.net 3.5sp1,并具有运行应用程序池的域帐户。我想关闭windows身份验证、wsHttpBinding和匿名。已删除mex终结点,设置消息安全性,但仍获得:

此服务的安全设置需要“匿名”身份验证,但未为承载此服务的IIS应用程序启用此身份验证

我已经尝试了大约50种不同的web.config配置,但没有乐趣

当前web.config:

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="PressReleaseService.PRBehavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="PressReleaseService.PRBehavior" name="PressReleaseService.PR">
            <endpoint address="" binding="wsHttpBinding" contract="PressReleaseService.IPR">
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>
        </service>
    </services>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IPR" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
            transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
            textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"
                enabled="false" />
                <security mode="Message">
                    <message clientCredentialType="Windows" negotiateServiceCredential="false"
                    algorithmSuite="Default" establishSecurityContext="true" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
</system.serviceModel>

此外,还有另一个服务在同一应用程序池下运行,其中包含mex,主端点具有wsHTTPBinding,并且仅在IIS中启用了windows身份验证


有什么线索吗?

您必须使用传输安全性将身份验证委托给IIS,并使用您在IIS中配置的设置。在这种情况下使用Windows身份验证

使用clientCredentialType进行消息身份验证意味着您希望使用kerberos实现消息安全性,因此在IIS上只应启用匿名功能。

IIS7中的解决方案:

web.config文件中的以下行:

<serviceMetadata httpGetEnabled="true" />

要求匿名访问.svc文件以进行http访问。要授予此权限,请打开IIS管理器,禁用匿名身份验证,并在应用程序顶部启用Windows身份验证。然后,进入“内容视图”选项卡,右键单击.svc文件。选择“切换到功能视图”。这将导致将.svc文件添加到左侧的目录树中。从那里,您可以转到IIS下的“身份验证”,并将匿名身份验证设置为启用。现在您可以匿名访问mex端点(我在中重新添加了它),但在其他任何地方都可以使用windows身份验证。其结果是c:\Windows\System32\inetsrv\config\applicationHost.config文件中出现如下更改:

<location path="Default Web Site/PRService_Dev">
    <system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="false" />
                <windowsAuthentication enabled="true" />
            </authentication>
        </security>
    </system.webServer>
</location>
<location path="Default Web Site/PRService_Dev/PR.svc">
    <system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="true" />
            </authentication>
        </security>
    </system.webServer>
</location>