views:

459

answers:

7

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). The 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.

+1  A: 

This won't change it but you could make the IISReset part of your post-build script.

No Refunds No Returns
Sounds like you're confirming this is normal and cannot be avoided by tweaking something somewhere. If that is the case, how could I make IISRESET part of the post-build script?
John Galt
Never mind, I found where to add IISRESET to the post build script. But are you confirming that this is normal behavior and the post-build script is the only workaround?
John Galt
You have tons of options: upgrade to VS2008/VS2K10, use another system, copy your build to another server, etc. IIS 5 was upgraded for a reason. Sorry but that's the state of the state. I can remember when IISRESET WAS the upgrade and it wasn't that long ago.
No Refunds No Returns
I have been putting up with this need for reset of IIS 5.1 but would like to learn more to close out this problem. Q's about your option list: (a) I already use VS2008 but it is WinXP IIS 5.1 platform (b) by "use another system" I guess you mean abandon this old WinXP dev machine I use (c) would "copy your build to another server" allow for interactive debugging while testing [I am guessing that approach would not allow breakpoints..]. Finally, this other fellow Bryan suggests this is "not normal" plus I seem to recall not having to do this post-build script before. Thanks for your time.
John Galt
+2  A: 

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.

Bryan
This has been on my back burner for a while but I'd like to resolve. You suggest this is not normal but the guys above emphasize this is the WAY IT IS with IIS 5.1. This ASP.NET solution (3 projects) was originally written with ASP.NET 1.1 and all files use Codebehind (not CodeFile). Can you elaborate a bit more on that point? Maybe that is it! I have a Web App Project but it has .vb source files. The project properties tab shows the "Build output path" as \binFinally, not sure what you mean about "dynamic compilation" - what setting is that? Thanks for your time.
John Galt
I use Windows XP to develop ASP.NET applications at home myself. I'm not there to double-check right now, but I am 99% sure that this behavior you are seeing is not the default behavior. Something is disabling the automatic AppDomain recycling. Dynamic compilation happens when you you have a CodeFile directive in an aspx or ascx file. So that's not happening, no worries. Question: Does your App reset if you edit and save changes to the web.config?
Bryan
Did some new tests based on these ideas: 1. Changed my connection string in web.config and then app failed as I would expect (i.e. the change was recognized and I couldn't connect). Would you consider that an "App reset"? 2. Changed my home page to display different content; rebuild app and run; old content (not current content) is shown! 3. Did IISRESET; 4. Run reveals the new current content after IISRESET; 5. Change homepage from CodeBehind to CodeFile; 6. Change content again; build app and run but new content NOT shown! 7. After IISRESET, new content shows OK.
John Galt
1. Yes, that would be an App reset. This other stuff... hard to follow you without more detail. When you say "changed my home page" do you mean the ASPX? If you are updating the aspx and not seeing changes immediately, you've got a caching issue, not an ASP.NET problem. But definitely don't use CodeFile if this is ASP.NET 1.1, that will do nothing. What ASP.NET version is IIS configured to run this app with?
Bryan
Bryan, thanks for hanging in here with me...So the App "resets" when I change web.config but does not "reset" when I change content. In this case, I did not change the home page content via the .ASPX alone; instead, I changed an assignment statement somewhere in Page_Load in the .ASPX.VB file: Me.txtMessage.text = "...this new text won't show till IISRESET is done..."All along this has been configured in IIS 5.1 to use ASP.NET 2.0. I only changed the home page from Codebehind to Codefile for this test. The bulk of the .aspx files use Codebehind. I hope this helps. Will look into caching.
John Galt
I see several possibilities:1) You have IIS configured to add an expiration header which is causing invalid caching.2) Someone has deliberately disabled the file-change notification for IIS. (search StackOverflow for how this is done)3) Your browser is caching the pages. Force a refresh. 4) Your IIS installation is just plain broken. Test it on a clean build of XP w/ IIS. 5) You have some .cs in App_Code which is being used instead of the codebehind you think is being used.I definitely recommend NOT mixing CodeBehind and CodeFile directives.
Bryan
Something's broken on your box. I use XP and 2k8 for my dev and it recompiles whenever I change a page. Make sure you're using CodeFile and dynamic recompilation as mentioned above. Otherwise, you may be up for a day of downtime... Wish I could offer more, that's my $0.02
drachenstern
A: 

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.

dh
+1  A: 

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...

Artiom Chilaru
Thank you for taking the time to read this and contribute. I did not think it was correct behavior either. I can live with it I think until I get a new, better development machine where I can get beyond IIS 5.1.
John Galt
A: 

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.

ntziolis
A: 

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.

Eric
A: 

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.

Niike2