加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

ExtendedProtectionPolicy.PolicyEnforcement值不匹配. IIS的值

发布时间:2020-12-14 03:54:11 所属栏目:Windows 来源:网络整理
导读:我正在处理处理WCF REST服务的安全网站. 一切都很好,直到我开始保护我的网站. 我将身份验证模式从匿名更改为 Windows身份验证,并在global.asax文件中实现自动化. 对于按MVC架构设计并使用内部服务的网站,一切都按预期工作但REST API运行不正常. 我已将安全配
我正在处理处理WCF REST服务的安全网站.
一切都很好,直到我开始保护我的网站.
我将身份验证模式从匿名更改为 Windows身份验证,并在global.asax文件中实现自动化.

对于按MVC架构设计并使用内部服务的网站,一切都按预期工作但REST API运行不正常.

我已将安全配置添加到web.config绑定部分,如下所示:

<binding name="webHttpBindingWindows">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm"></transport>
      </security>
    </binding>

和:

<binding name="webHttpBindingWindows">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" proxyCredentialType="Windows"></transport>
      </security>
    </binding>

有和没有:

<extendedProtectionPolicy policyEnforcement="WhenSupported"></extendedProtectionPolicy>

但我得到了这个例外:

The extended protection settings configured on IIS do not match the settings configured on the transport. The ExtendedProtectionPolicy.PolicyEnforcement values do not match. IIS has a value of WhenSupported while the WCF Transport has a value of Never.

有没有人知道如何解决它?

如果我将IIS上的扩展保护设置为关闭,我根本无法进行身份验证. (我有浏览器弹出窗口,但无法使用任何用户帐户登录.)

谢谢,
纳夫塔利.

解决方法

最终我得到了这个问题的解决方案:

这些变化发生在三个不同的地方:

>应关闭IIS扩展保护.应启用内核模式身份验证.
> Web配置文件有两处更改:

>< transport clientCredentialType =“Ntlm”>< / transport>
>服务配置内部< endpoint address =“mex”... />没有地址=“休息”

>在global.asax授权实现中,我在处理REST请求时删除了cookie的使用:

public void WindowsAuthentication_OnAuthenticate(object sender,WindowsAuthenticationEventArgs args)

现在它像忍者一样工作!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读