3 Replies - 218 Views - Last Post: 03 April 2019 - 08:45 AM Rate Topic: -----

#1 complete   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 117
  • Joined: 12-April 07

Why would we want to lock web.config and how would you do it?

Posted 03 April 2019 - 07:29 AM

How do you perform locking on Web.Config and why would you do it? This is going to be a long post. But stay with me. I will step you through this.

I have a Web Site I am trying to debug and explore. It is used already. It is already in a workable state on the computers of my peers in my development group. I just want to step through the code in debug mode. To do this, according to a peer I work with, I need to start the web site locally and then attack the project I have loaded in Visual Studio to the running project.

This brings me to the error I am stumped on. when I open IIS and click on the option to "Browse *.80 (http)" for the website that is listed and has been validated, it launches the website in a browser but it has an error:

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information:

Module
IIS Web Core

Notification
BeginRequest

Handler
Not yet determined

Error Code
0x80070021

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

Config File

\\?\C:\Users\....\web.config

Of course I have modified the path to the web.config to keep this anonymous.

The "Config Source:" on the page has a red highlighted line that has the XML node, <handlers> but this does not seem to be useful information.

The "More Information" area at the bottom of the page says:

More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
View more information

Since the HResult code is 0x80070021, the corresponding Error message listed on this hyperlink page, https://support.micr...iis-7-0-webpage is:

Server Error in Application "application name"

HTTP Error 500.19 Internal Server Error

HRESULT: 0x80070021

Description of HRESULT
The requested page cannot be accessed because the related configuration data for the page is invalid.

The Cause is: This problem can occur when the specified portion of the IIS configuration file is locked at a higher configuration level.

The Resolution is: To resolve this problem, unlock the specified section, or do not use it at that level. For more information on configuration locking, see How to Use Locking in IIS 7.0 Configuration.

This links to this page https://docs.microso...s-configuration which describes locking of different elements in a configuration file.

Apparently, according to this document online, I might be able to solve this issue by following the steps described.

The page mentions applicationHost.config but the error page I get references web.config but I assume that if I change

<handlers> to <handlers overrideMode="Allow"> then it might work

and yet, intellisense says that "overrideMode" is not an allowed attribute.

Is This A Good Question/Topic? 0
  • +

Replies To: Why would we want to lock web.config and how would you do it?

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15058
  • View blog
  • Posts: 60,124
  • Joined: 12-June 08

Re: Why would we want to lock web.config and how would you do it?

Posted 03 April 2019 - 07:32 AM

I'm not following. Are you having issues F5 debugging a website in Visual Studios locally, or what exactly?
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 6913
  • View blog
  • Posts: 23,492
  • Joined: 05-May 12

Re: Why would we want to lock web.config and how would you do it?

Posted 03 April 2019 - 08:30 AM

I recommend installing IIS locally on your machine instead of using IIS Express. IIS Express is great for the initial development, but if you are dealing with a legacy system which was created using VS2012 or older, the IIS is the better option.

Alternatively, you can use the MSVC Remote Debugging. Then you can keep the site run where it currently is, and simply debug remotely.
Remote Debug ASP.NET on a Remote IIS Computer
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 6913
  • View blog
  • Posts: 23,492
  • Joined: 05-May 12

Re: Why would we want to lock web.config and how would you do it?

Posted 03 April 2019 - 08:45 AM

Forgive all the handwaving, but I'll try to explain what you are currently observing: The documentation you are reading is with regards to locking/unlocking up at the machine level -- applicationhost.config. What IIS Express does is that it emulates the behavior of ASP.NET running inside IIS, but down at a smaller scale. The configuration used by IIS Express is actually over in the "IISExpress" folder below your "My Documents" folder.

Unless you really know what you are doing, I recommend not messing with those files.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1