2016-10-31 45 views
0

我的下一個問題轉化我的web.config時:源文件中沒有匹配元素/configuration/system.web/authorization/

源文檔中的任何元素相匹配「/配置/系統。網站/授權/允許[@角色= 'WhateverGroupNameRenamedForProd']」

這裏我 的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> 

我做錯了什麼?感謝提前:)

回答

0

對於那些已經有興趣,我發現和解決了這一問題:它基本上是在SetAttributes:

我的舊代碼:

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

應代之以

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

那麼你就這樣指定的SetAttributes屬性名稱,在我的情況,這是「角色」。