WCF - IIS Windows 身份验证 [英] WCF - IIS Windows Authentication

查看:36
本文介绍了WCF - IIS Windows 身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我一直在尝试让我的 WCF 与 Windows 身份验证一起使用.当匿名打开时,以下工作正常.已经搜索了许多互联网文章,但无法使其正常工作.谢谢


I have been trying to get my WCF to work with Windows Authentication. The following works fine when anonymous is turned on. Have searched many internet articles and cannot get this to work. Thanks

这是我的配置:
IIS
基本身份验证和 Windows 身份验证已打开.
匿名已关闭

Here is my configuration:
IIS
Basic Authentication and Windows Authentication turned on.
Anonymous turned off

客户:

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IEchoService" 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">
                    <transport clientCredentialType="Windows" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true"
                        algorithmSuite="Default" establishSecurityContext="true" />
                </security>
            </binding>

        </wsHttpBinding>
    </bindings>

    <client>
        <endpoint address="http://id.unittest/Services/EchoService.svc"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IEchoService"
            contract="IEchoService" name="WSHttpBinding_IEchoService">
            <identity>
                <servicePrincipalName value="host/mikev-ws" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>

服务器:

<system.serviceModel>

    <behaviors>
        <serviceBehaviors>
            <behavior name="MyServiceTypeBehaviors">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service name="Project.API.Services.EchoService" behaviorConfiguration="MyServiceTypeBehaviors">
            <endpoint address="" binding="wsHttpBinding" contract="Project.API.Services.IEchoService" />
            <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
        </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>

</system.serviceModel>

推荐答案

在以下链接中:WCF 错误:服务未对调用方进行身份验证

寻找 Sandip 给出的答案,这是第二个答案.

look for the answer given by Sandip, its the second answer.

这篇关于WCF - IIS Windows 身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆