0

I develop a site on my local box using VS.NET 2013 and I have IIS pointing to my local drive where the files are. My site requires me to login, so I'll login and navigate to a page. If I see a style on that page that needs to be fixed, I'll edit the css file and try to refresh the page in my browser. But the site kicks me off and forces me to login again, which is caused by the IIS site recycling because of the .css file edit.

Is there a way to prevent it from recycling for a css file edit? I noticed that I can usually modify .aspx pages without the recycle. The site is a mix of ASPX and MVC pages.

Update

I develop in VS.NET, but I don't run it on my box thru IIS Express, but thru IIS itself.

I am only editing the .css file and eventually after a few saves, the site recycles. I've also tried editing the .css file in notepad and those edits eventually recycle the site as well.

I did add ScottGu's code (http://weblogs.asp.net/scottgu/433194) to Application_End() that logs what the shutdown reason was, and what it is reporting is the following:

_shutDownMessage=Change in App_Offline.htm
HostingEnvironment initiated shutdown
Change in App_Offline.htm
Change in App_Offline.htm
Change in App_Offline.htm
Change in App_Offline.htm
Change in App_Offline.htm
Change in App_Offline.htm
Change in App_Offline.htm
HostingEnvironment caused shutdown

_shutDownStack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
   at System.Web.HttpRuntime.ShutdownAppDomain(String stackTrace)
   at System.Web.HttpRuntime.OnAppOfflineFileChange(Object sender, FileChangeEvent e)
   at System.Web.DirectoryMonitor.FireNotifications()
   at System.Web.Util.WorkItem.CallCallbackWithAssert(WorkItemCallback callback)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

I don't know how app_offline.htm is getting modified as I am not touching it. In fact, I do not have a file named app_offline.htm because if I did, I would not be able to see the site/login/etc.

Sounds like I need to get a file watcher and see who is touching it, but I suspect something else is touching app_offline.htm in order to trigger a recycle.

slolife
  • 19,520
  • 20
  • 78
  • 121

2 Answers2

0

IIS should not restart because of a CSS edit. Modifying the web.config file is usually what triggers a recycle. Also, possibly modifying the contents of the Bin folder.

Also, check out What causes an application pool in IIS to recycle?

Community
  • 1
  • 1
Jim Billig
  • 344
  • 2
  • 14
  • 1
    I can reproduce every time with a .css file modification. I agree that it shouldn't, but it does. – slolife Nov 17 '14 at 23:24
  • What Jim is saying is correct. How are you modifying the .css file? And, how do you run your web app? Using VS? – Sam Nov 18 '14 at 01:24
  • See my update. I added code to the site to track the reason the site is shutdown. It says it is because App_Offline.htm was modified, but I don't have that file on my site, so something else must be touching it to trigger a recycle. – slolife Nov 18 '14 at 17:42
0

While IIS and ASP.Net do not handle css files by default, this is just an option that can be changed. Sometimes, you want to use ASP.Net to alter a css file on the server before sending it to the browser (though usually there are better ways to accomplish the same things).

Open up the IIS manager, click on your site in the tree in the Connections pane on the left, and then find the Handler Mappings icon in the IIS section on the right. Open this up and see if you have a mapping for a *.css path anywhere.

Additionally, you can define handlers in your web.config file. Look in your web.config and see if you have a handler defined for css files (though anything here should also show in the IIS Manager view).

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
  • No handlers are mapped to *.css. I do however use ASP.NET MVC BundleConfig.cs to create js and css bundles. I wonder if that has an effect. – slolife Nov 18 '14 at 18:13