What happens when I edit web.config?
Asked Answered
J

5

88

I need to edit the web.config file on a live Sharepoint environment, but I'm unsure what will happen if I do (I want to output custom errors).

Will this cause the IIS6 worker process to recycle?

Will active users lose their session state because of this?

Or can I safely edit the file?

Johnathan answered 7/10, 2008 at 13:8 Comment(1)
You may define sessions to be placed on a remote machine, so application reset will not cause session's lostRegorge
C
83

The application pool will restart and session state will be lost. Imagine each ASP.NET application (as defined in IIS) is a program on the desktop. Saving web.config will do something similar to closing the program and reopening it.

Casaubon answered 7/10, 2008 at 13:13 Comment(10)
Not sure about IIS6, but in IIS7 and IIS8 this is the default behavior, though you can change it via Application Pools > Advanced Options > Recycling > Disable recycling for configuration changes = true which is helpful for production environments, for example, so that the admins can make a change that need not go into effect until the next recycle. With Sharepoint specifically there is a way to schedule the changes so that they are applied at a specific time, I believe.Klepac
@Klepac But, does setting Application Pools > Advanced Options > Recycling > Disable recycling itself cause an app pool recycle? Turtles all the way down?Lackadaisical
Hi @DanGoldstein. You mention 'something similar' to closing the program and reopening. What about static state? Is static state ensured to be wiped out by a web.config edit? The reason is that I cache some web.config stuff in static variables.Yoga
Honestly, I'm not a good source of information about this any more. When I answered, I was using IIS and ASP.Net full time. I'm just a hobbyist software developer these days.Casaubon
@DirkBoer The whole reason I'm here is to find out the definitive answer to your question. In my experience, editing the web.config does not affect static properties.Length
I think "AppDomain recycle" will occur instead of "Application pool" recycle. Correct me if I am wrong.Louise
What if the app pool has many applications under it. Editing web.config of one site and restart of application pool doesn't seem to be ok.Louise
At what point in asp.net life cycle web.config is being read by iis? On app_start event?Motivity
It will recycle the AppDomain, not AppPool. So other web applications running under that app poll will not be affected.Kosse
According to this answer, it looks like the app will wait for requests to respond before recycling. Which is a little different from closing the program and reopening it.. Or are you saying that that answer is wrong?Supranatural
N
31
  1. Yes. It will be recycled.
  2. Yes. They will lose their session.
  3. Yes. You can safely edit the file. I suggest you to read this MSDN article : Working with web.config Files in Windows SharePoint Services
Nullifidian answered 7/10, 2008 at 13:14 Comment(0)
B
10

Also if Session state is configured as out-of-process (database or service) then recycling the app pool won't lose any session state. This is as true for Sharepoint as it is for vanilla ASP.Net.

Brachium answered 8/10, 2008 at 15:25 Comment(0)
K
3

When you edit the web.config, It will restart the AppDomain (NOT AppPool) of that web application and clears the all occupied resources and memory. So other web applications running under that App Pool will not be affected. Also it will clear the sessions (in-proc) and memory cache.

Kosse answered 20/6, 2018 at 23:11 Comment(0)
A
1

As already mentioned by some people: the application pool of the site in IIS will restart (this typically takes a couple of seconds). As a result the next page request(s) will be slower (since nothing will be cached anymore). Also the session state of the users will be lost; BUT in WSS session state is not used by default, in MOSS it is used by InfoPath Form Services. So it could be that you don't have big issues related to losing session state.

On the other side; to overcome those issues: what is typically done is to create a SharePoint Solution (WSP) that deploys and starts a Timer Job to make the changes to the web.config from code (using the SPWebConfigModification class of the Object Model). The nice thing is that you can schedule the execution of the change, so your users won't notice it.

Annelid answered 8/10, 2008 at 6:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.