本文介绍了源文档中没有元素与/configuration/system.web/authorization/相匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

转换Web.Config时出现下一个问题:

I have the next issue when transforming my Web.Config:

这是我的 Web.Config:

 <system.web>
<compilation targetFramework="4.5.2" debug="true" />
<httpRuntime targetFramework="4.5" />
<authorization>
  <allow roles="WhateverGroupName" />
  <deny users="*" />
</authorization>

还有 Web.Production.Config:

<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<authorization>
  <allow roles="WhateverGroupNameRenamedForProd" xdt:Transform="SetAttributes" xdt:Locator="Match(roles)"/>
</authorization>

我做错了什么?在此先感谢:)

What I'm doing wrong? Thanks in advance :)

推荐答案

对于已经感兴趣的人,我发现并解决了这个问题:基本上是在SetAttributes上:

For the ones already interested, I found and fixed the problem: It was basically on the SetAttributes:

我的旧代码:

<allow roles="WhateverGroupNameRenamedForProd" xdt:Transform="SetAttributes" xdt:Locator="Match(roles)"/>

应替换为:

<allow roles="WhateverGroupNameRenamedForProd" xdt:Transform="SetAttributes(roles)"/>

然后,您可以在 SetAttributes 上指定属性名称,在我的情况下为角色".

Then you have so specify the attribute name on the SetAttributes, in my case it was "roles".

这篇关于源文档中没有元素与/configuration/system.web/authorization/相匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:25