2017-08-16 120 views
1

问题的工作是,我不能让Windows身份验证与工作​​的wsHttpBinding。WCF Windows身份验证不WsHttpBinding的

这是配置:

<services> 
    <service name="WcfService1.Service1"> 
    <endpoint address="" bindingConfiguration="testbinding" contract="WcfService1.IService1" binding="wsHttpBinding"/> 
    </service> 
</services> 
<bindings> 
    <wsHttpBinding> 
    <binding name="testbinding"> 
     <security mode="Transport"> 
     <transport clientCredentialType="Windows"/> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

这是从服务器试图调用的方法时的响应: HTTP请求是未经授权的客户端身份验证方案协商'。从服务器收到的验证头是'Negotiate oXMwcaADCgEBomoEaGBmBgkqhkiG9xIBAgIDAH5XMFWgAwIBBaEDAgEepBEYDzIwMTcwODE2MjA1MjQwWqUFAgMK8G2mAwIBKakOGwxDT1JQLlNBQUIuU0WqGjAYoAMCAQGhETAPGw1jb3JwYXBwbDU5ODgk'。 也有一个内部异常说法: “目标主要名称不正确”

我已经安装IIS中的新网站新的用于测试目的启用Windows身份验证和其他残疾的一切(我没有做任何ASP模拟/双跳)。 Windows身份验证提供商是Negotiate,Ntlm。内核模式认证已启用。 应用程序池与Active Directory服务帐户一起运行。 最终的目标是使用Kerberos进行身份验证,但由于它甚至不能使用Ntlm,所以我还没有开始使用SPN以及那些让Kerberos工作的东西。

如果我更改应用程序池与“ApplicationPoolIdentity”,而不是AD服务帐户运行但它确实工作? 我必须拥有使用AD服务帐户运行的应用程序池。

如果我改变配置来:

<services> 
    <service name="WcfService1.Service1"> 
    <endpoint address="" bindingConfiguration="hbinding" contract="WcfService1.IService1" binding="basicHttpsBinding"/> 
    </service> 
</services> 
<bindings> 
    <basicHttpsBinding> 
    <binding name="hbinding"> 
     <security mode="Transport"> 
     <transport clientCredentialType="Windows"/> 
     </security> 
    </binding> 
    </basicHttpsBinding> 

它工作正常(保持AD服务帐户为好),这是为什么? 我不想使用basicHttpsBinding

我看到在客户端配置文件的差异(使用wcftestclient),使用wshttp它时:

<identity> 
     <userPrincipalName value="[email protected]" /> 
    </identity> 

是否有一些与此有关? (只是猜测疯狂这里)

终点为https,基于Windows Server 2012R2 IIS 8。

回答

0

在客户端生成的身份标签是造成问题

<identity> 
    <userPrincipalName value="[email protected]" /> 
</identity> 

如果我清楚它工作正常价值。 所以我清除了web.config中的值。 我现在可以设置kerberos,它也可以正常工作,也可以尝试设置servicePrincipalName标记。

0

很多这取决于如何为您的站点设置,但你可以尝试不同类型的客户端凭据类型:

<services> 
    <service name="WcfService1.Service1"> 
    <endpoint address="" bindingConfiguration="testbinding" contract="WcfService1.IService1" binding="wsHttpBinding"/> 
    </service> 
</services> 
<bindings> 
    <wsHttpBinding> 
    <binding name="testbinding"> 
     <security mode="Transport"> 
     <transport clientCredentialType="Ntlm"/> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

此外,利用的wsHttpBinding有谈判,是以幕后的地方。由于对谈判的指导,没有特别限制它是有道理的,有时将其关闭:

<services> 
    <service name="WcfService1.Service1"> 
    <endpoint address="" bindingConfiguration="testbinding" contract="WcfService1.IService1" binding="wsHttpBinding"/> 
    </service> 
</services> 
<bindings> 
    <wsHttpBinding> 
    <binding name="testbinding"> 
     <security mode="Transport"> 
     <message negotiateServiceCredential="false" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

Kerberos身份域必须存在,为它工作。

+0

谢谢你的答案,但我不能使用NTLM(由于安全限制) 我设法解决它(回答以下) – user2782999