以下是我的 web.config 中的 system.webServer 部分:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<httpLogging dontLog="false" selectiveLogging="LogError" />
</system.webServer>
这是一个 MVC 4 Web 应用程序,我在这里想要完成的任务是在将 MVC 应用程序部署到 Azure 时禁用 IIS 日志记录。但每次我使用 httpLogging 节点运行 Web 应用程序时,都会收到 500 错误。
我已经在 Visual Studio 的 IIS Express 和我的本地 Azure 模拟器中测试了 Web 应用程序,两者都导致了 500 错误并显示以下消息:
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
我做错了什么?
最佳答案
出于安全原因,您无法更改 Web.Config
中的某些部分。
您可以更改此设置。这是一个很棒的answer如何在可以访问管理控制台的本地计算机或服务器上执行此操作。对于这个问题,还有一些其他答案,您可以使用 command line 了解如何更改它。 .
关于asp.net-mvc - 将 httpLogging 设置添加到 MVC web.config 时出现 HTTP 错误 500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27927136/