asp.net-mvc - 将 httpLogging 设置添加到 MVC web.config 时出现 HTTP 错误 500

标签 asp.net-mvc iis azure

以下是我的 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".

enter image description here

我做错了什么?

最佳答案

出于安全原因,您无法更改 Web.Config 中的某些部分。

您可以更改此设置。这是一个很棒的answer如何在可以访问管理控制台的本地计算机或服务器上执行此操作。对于这个问题,还有一些其他答案,您可以使用 command line 了解如何更改它。 .

关于asp.net-mvc - 将 httpLogging 设置添加到 MVC web.config 时出现 HTTP 错误 500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27927136/

相关文章:

asp.net-mvc - 种子 MVC5 Entity Framework 6 中的无效登录尝试

c# - iis工作进程内存使用率与处置对象之间的关系?

c# - 发送简单的电子邮件 ASP.NET MVC, IIS7

java - 如何使用 Java SDK 从远程 Azure 应用程序配置检索服务总线队列的队列名称?

使用 AAD Graph 客户端后,Azure AD B2C 租户似乎已损坏

asp.net-mvc - stackoverflow URL 重写

c# - 在 Umbraco 站点上处理 MVC 部分 View 中的全局设置节点

asp.net-mvc - 带asp.net MVC应用程序的WCF服务

c# - 通过 HttpWebRequest 发送客户端证书,间歇性工作

c# - 未处理的异常。系统聚合异常 : Some services are not able to be constructed