Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change to web.config on server is not going into effect

when I debug my website locally using Visual Studio, the change to the web.config goes into the effect without any problem.

However, when I make the same change to the web.config on my server host (running IIS 7.5) it looks like the site is still running off the old version of web.config when I load it up in my browser. The new changes aren't applied.

I have tried stopping and starting my site's application pool on the server using IIS Manager, but still no change. I've also tried stopping and starting IIS, which isn't working either.

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

BEFORE:

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

AFTER:

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

What is the reason for this?

like image 339
Krondorian Avatar asked Aug 15 '13 20:08

Krondorian


People also ask

Do I need to restart IIS after changing Web config?

Changes to the web. config will trigger the app to be reloaded by IIS as soon as there are 0 connections left to the app. You can also stop and restart the app pool that the app is assigned to in order to make this happen. You do not need to stop and restart IIS itself.

What happens when you change the web config file at run time?

the answer i found :- ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET automatically restarts the application to apply the changes.


1 Answers

I have found that if I attempt to modify the Web.config directly through the file system (on an IIS server), my changes fail to be saved, and thus, are not applied. This is what I have found works for me, provided you have access to IIS on the host server:

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

  1. Go to the IIS Manager on the host server
  2. Drill down in the Sites until you find your application
  3. Using the Features view, double-click the Authorization Rules
  4. Use the Add Allow Rule... and Add Deny Rule... link in the Actions panel (on the right) to configure all your authorization rules.

This process updates the Web.config for you. If you need to edit or delete a rule, click on the applicable rule, then click the Edit... or Remove link in the Actions panel.

I hope this helps.

like image 50
Grislibar Avatar answered Sep 28 '22 07:09

Grislibar