A change to web.config on the server does not take effect

when I debug my site locally using Visual Studio, the change in web.config takes effect without any problems.

However, when I make the same change in web.config on my server host (works with IIS 7.5), it looks like the site is still working with the old version of web.config when I load it into my browser. New changes are not applied.

I tried to stop and start the site application pool on the server using IIS Manager, but still no changes. I also tried to stop and start IIS, which also does not work.

The change I am making for my web.config involves deleting entries in the block to allow and deny users. It is currently set up to request credentials, and if it is valid, the site is accessible. If not, access is denied. The change I'm trying to make is to allow access to all users and not request their credentials.

BEFORE:

<authorization> <deny users="?" /> <allow roles="admins" /> <deny users="*" /> </authorization> 

AFTER:

 <authorization> <allow users="*" /> </authorization> 

What is the reason for this?

+10
web-config
source share
6 answers

You need to reset IIS. Just open a command prompt and run IISRESET, and you should be good.

+4
source share

Do you deploy, publish or copy? Make sure the debug and release options are the same. There are also cases where the virtual directory is not configured correctly and the correct webconifg does not load.

0
source share

I found that if I try to modify Web.config directly through the file system (on the IIS server), my changes will not be saved and therefore will not be applied. This is what I found for me to work if you have access to IIS on the core server:

NOTE. . These instructions are based on IIS 8 on Windows Server 2012, but may work for IIS 7.5.

  • Go to IIS Manager on the host server.
  • Expand the node until you find your application.
  • Using the Features view, double-click Authorization Rules
  • Use the Add Allow Rule ... and Add Deny Rule ... links in the Actions panel (on the right) to configure all your authorization rules.

This process updates Web.config for you. If you need to edit or delete a rule, click on the corresponding rule, and then click the Change ... or Delete link in the Actions panel.

Hope this helps.

0
source share

Copy the web.config file from your server and put it on your local computer and modify it according to your requirements. Then delete the web.config file on the server and copy and paste the modified web.config file from the local machine to the server.

This work for me, but for me connectionstring was a problem.

0
source share

You must do the following

  1. Press the BUILD menu
  2. choose Net Solution
  3. after that
  4. select Rebuild application
  5. Published files (codes)

Above this action, it works fine, no problem.

Reflect changes in IIS

0
source share

From MSDN - Web.Config

Any changes to the web.config file will require a restart of the Microsoft IIS Administration service for the changes to take effect.

0
source share

All Articles