【问题标题】:Web.Release.Config authentication attributeWeb.Release.Config 身份验证属性
【发布时间】:2016-01-05 22:46:09
【问题描述】:
我定义了一个从浏览器获取凭据的 WebApi,它可以工作。
部署后,我必须将服务器上的身份验证从Anonymouns 编辑为Windows。我试图将<authentication mode="Windows"/> 添加到 Web.Config.Release 但它没有改变......
为什么?有什么建议吗?
【问题讨论】:
标签:
c#
windows-authentication
web-release-config
【解决方案1】:
.Release.Config 文件本身不是.Config 文件 - 它是一个描述如何转换默认Web.Config 文件为新的Web.Config 文件以供发布的文件。
因此,您不能简单地向其中添加节点 - 您需要使用为此定义的语法指定要进行的修改 - 请参阅 https://msdn.microsoft.com/library/dd465318(v=vs.100).aspx
在你的情况下,你可能想要这样的东西:
...
<system.web>
<authentication mode="Windows" xdt:Transform="SetAttributes" />
</system.web>
...