在我的 Web.Config 我有以下
<system.webServer>
<modules>
**some code**
</modules>
<handlers>
**some code**
</handlers>
</system.webServer>
如何对其进行转换,以便将“安全”的新子部分注入(inject)“system.webServer”?到目前为止,我尝试和搜索的一切都失败了。
我想要的如下所示:
<system.webServer>
<modules>
**some code**
</modules>
<handlers>
**some code**
</handlers>
<security>
<ipSecurity allowUnlisted="false" denyAction="NotFound">
<add allowed="true" ipAddress="10.148.176.10" />
</ipSecurity>
</security>
</system.webServer>
最佳答案
找到了有效的解决方案。在我的 Web.Azure.Config 文件中,我必须添加以下内容:
<system.webServer>
<security xdt:Transform="Insert">
<ipSecurity allowUnlisted="false" denyAction="NotFound">
<add allowed="true" ipAddress="10.148.176.10" />
</ipSecurity>
</security>
</system.webServer>
我在发布问题之前尝试了这个,但由于 Web.Config 的另一部分中的拼写错误,它出错了。
关于asp.net - 有没有办法使用转换将新部分 "insert"放入 Web.Config?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23709851/