简体   繁体   English

WCF-IIS Windows身份验证

[英]WCF - IIS Windows Authentication


I have been trying to get my WCF to work with Windows Authentication. 我一直在尝试使WCF与Windows身份验证一起使用。 The following works fine when anonymous is turned on. 启用匿名功能时,以下各项可以正常工作。 Have searched many internet articles and cannot get this to work. 搜索了许多互联网文章,无法使它正常工作。 Thanks 谢谢

Here is my configuration: 这是我的配置:
IIS IIS
Basic Authentication and Windows Authentication turned on. 基本身份验证和Windows身份验证已打开。
Anonymous turned off 匿名关闭

CLIENT: 客户:

<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>

SERVER: 服务器:

<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>

in the following link: WCF error: The caller was not authenticated by the service 在以下链接中: WCF错误:服务未对调用方进行身份验证

look for the answer given by Sandip, its the second answer. 寻找Sandip给出的答案,这是第二个答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM