开发者

WCF - IIS Windows Authentication

开发者 https://www.devze.com 2023-02-19 09:45 出处:网络
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

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

Here is my configuration:

IIS

Basic Authentication and Windows Authentication turned on.

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="mexH开发者_StackOverflowttpBinding" address="mex"/>
        </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>

</system.serviceModel>


in the following link: WCF error: The caller was not authenticated by the service

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

0

精彩评论

暂无评论...
验证码 换一张
取 消