Krondorian
Krondorian

Reputation: 626

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?

Upvotes: 14

Views: 26299

Answers (8)

Eduard Frankford
Eduard Frankford

Reputation: 351

For me the problem was that I was building multiple solutions in the Azure DevOps pipeline and the deploy.cmd took the first web.config file as given. Therefore, I had changed the wrong web.config and the solution was to build via the csproj file and not via the solution.

Hope this helps somebody! :-)

Upvotes: 0

Mahdi Moghimi
Mahdi Moghimi

Reputation: 568

Maybe, maybe and maybe it help some one. I have the same problem. with IIS reset not work. with recycling AppPool not work. Maybe your drive have not free space.

This work sometimes after I delete some unwanted files. but I think important reason is Permission. we must use Editor like notepad or Run editor as administrator or web.Config need permission to change and then change Web.config. then Save.This works for me.

Upvotes: 0

Nikola
Nikola

Reputation: 125

From MSDN - Web.Config

Any changes to the web.config file will require restarting the "Microsoft IIS Administration" service to take effect.

Upvotes: 0

Ramarasan Manickam
Ramarasan Manickam

Reputation: 1

You have to do following action

  1. Click the BUILD menu
  2. select the Clean Solution
  3. after then
  4. select the Re-build Application
  5. Published the files (codes)

Above this action done, It is working fine without issue.

Reflecting changes in IIS services

Upvotes: -2

shankar.siva
shankar.siva

Reputation: 309

Copy the web.config file from your server and place it in your local machine and modify according to your requirements. And then delete the web.config file in the server and copy and paste the modified web.config from local machine to server.

This work for me, but for me connectionstring was the Issue.

Upvotes: 0

Omar
Omar

Reputation: 129

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

Upvotes: 4

Grislibar
Grislibar

Reputation: 21

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.

Upvotes: 2

KonB
KonB

Reputation: 220

Are you deploying,publishing or copying? Make sure that your debug and release settings are the same. There are also instances when the virtual directory is not setup correctly and the correct webconifg is not loading.

Upvotes: 0

Related Questions