How to reduce the need for IISRESET for developing ASP.NET web app in IIS 5.1
I have a web application project on my dev PC running WinXP and hence IIS 5.1. The changes I'm making to this site seem to "take effect" only after I do IISRESET. That is, I make a source change, Rebuild the project and then Start without Debugging (or with debugging). T开发者_开发技巧he newly changed code is not "visible" or in effect unless I intervene with an IISRESET.
BTW, the "web" tab on the Properties display for the web app project is configured to use the Local IIS web server at project Url: http://localhost/myVirtualDirectory
...
but I've noticed the same issue when using the VStudio Dev Server (i.e. I have to stop it by visiting the taskbar tray area in order to see my source changes take effect).
Is this something I can change?
EDIT UPDATE:
Just wanting to clear this up if possible. Two answers diverge below; not sure how to move forward. One states this is to be expected (weakness of IIS 5.1 which in turn is the best WinXP can provide). Another states this is not expected behavior (and I tend to agree since this is the first I've encounted this on the same old WinXP dev platform I've had a long time). I suspect it may be something "deep inside" the Visual Studio 2008 web app which was upgraded to this new IDE from VStudio 2002 (ASP.NET 1.1). I've tried to add comment/questions down each answer path. Thanks.
This is not normal behavior at all. ASP.NET should automatically reload any assemblies you put in your bin directory. If you are using dynamic compilation, it should pick up new code in codebehind files as well.
One, make sure you are using the correct CodeFile or CodeBehind directive. CodeFile is for dynamic compilation.
If you've got a Web Application Project and compiling your .cs source files into a DLL, then make sure your project is dropping the DLL into the correct directory... which is /[ApplicationRoot]/bin.
This won't change it but you could make the IISReset part of your post-build script.
I do have to say that it's not the standard behaviour. I have been developing in VS2005 for awhile now, and I have been using XP, 2003 and later systems. But even on XP I've never had that happen.
Last year, two of my co-workers were still using XP to develop the web app we've been working in.. And we were working on the EXACT same codebase, shared in an SVN repository.. One of them had the same issue you have here, and we couldn't find a solution, and we just left it as it was.. The other coworker's machine was working absolutely fine (both on identical hardware)
It's a sad story, because in the end his IIS became so messed up that he was forced to use the VS web server instead for a couple of months until the sysadmin agreed to reinstall Windows in his box :)
The morale of the story? I think your Windows / IIS installation is messed up... Try to get the latest updates from MS, and if nothing else helps - I'd recommend doing a clean install.. Sorry, but hope this helps...
You may want to check the registry key located here:
HKLM\Software\Microsoft\ASP.NET\FCNMode
If you see this registry key, be sure it's set to 0 or greater than 2. If it's set to 1, ASP.NET will not receive a file change notification when you build and you will experience the exact symptoms you're describing. Whenever you build your web application solution the app should restart. If that's not happening, this may be the answer.
Same symptoms together with permanent memory usage growth showed me once that some controls where not cleaned up because of wrong singleton usage. I'd propose to do some memory profiling of your application.
I've experienced similar issues in the past. What will always trigger the application to be properly reloaded is ANY change in the web.config.
Just insert an empty string at the end and save it and the web app will be reloaded at the next page load. For my purposes I've created a script that does it after every build. It sounds simple but it always works.
Had the same problem and managed to find a wierd answer.
Problem: When the source-code is edited and IIS does not want to update the edit.
In Project Settings, Web I changed the Servers to Use Visual Studio Development Server instead of Use IIS Web server.
Then ran VS Development Server with F5 so I can see the change after SourceCode edit. I left the Setting, but then went to my homepage using IIS server instead. Now the changes are updating like it should.
So, when leaving out IIS and telling it NOT to be used in Project Settings. IIS is fetching the new source code and displaying the changes.
精彩评论