简体   繁体   中英

HTTP Error 500 when adding httpLogging setting to MVC web.config

The following is the system.webServer section in my web.config:

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />

    <httpLogging dontLog="false" selectiveLogging="LogError" />

</system.webServer>

It's an MVC 4 web application and what I am trying to accomplish here is to disable IIS logging when deploying my MVC app to Azure. But every time I run the web application with the httpLogging node I get a 500 error.

I've tested the web application in Visual Studio's IIS Express and my local Azure emulator and both resulted in a 500 error with the following message:

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".

在此输入图像描述

What am I doing wrong?

For security reasons you can't change some sections in Web.Config .

You can change this settings. Here is a great answer how to do it on local machine or server where you can access admin console. For this question the are some other answer and you can find out how to change it with command line .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM