Oi my second post in like lank long sorry i been buzzzy :o)
Working on a solution where we are hosting our server side components in iis (remoting). We are using our local dev machines IIS installations during dev.
Came across an issue when recompiling...
The components don't refresh properly in the cache after making a server side change and no matter what we did flushing etc still didn't work. Of course this results in client (proxy) and server being out of sync.
I cant believe my solution to this is the best way there has to be some dumb ass setting somewhere however i couldnt find it ?
Anyway...
Did some reserch into this on the net, there are a number of solutions to this problem
1. Post build event on client application calls iisreset - issue resets iis takes lank time
2. Create separate build configurations to build server and client individually fine a bit trickey to get right also, doing a full build it fails anyway.
3. Updating the web config or machine config and setting the following in compilation tag
numRecompilesBeforeAppRestart="2">
Problem is you have to build then run twice to get it to work and you cant set the value to 0 or 1 btw: Default is 15 in Asp.Net.
Couldnt find any more quick fix solutions to this on the net so i came up with this one and it seems to work oki dokie.. I used the attrib part to take care of our source control system. All i had to do was add this as a post build event on my client application.
attrib -r C:\Inetpub\wwwroot\RemotingHost\Web.Config & type C:\Inetpub\wwwroot\RemotingHost\Web.Config > C:\Inetpub\wwwroot\RemotingHost\Web_TMP.Config & type C:\Inetpub\wwwroot\RemotingHost\Web_TMP.Config > C:\Inetpub\wwwroot\RemotingHost\Web.Config & del C:\Inetpub\wwwroot\RemotingHost\Web_TMP.Config & attrib +r C:\Inetpub\wwwroot\RemotingHost\Web.Config
Basically this forces a restart of the application because the web.config changes default behavior is to restart the application, not the whole of iis.
Perhaps another solution is to restart an iis application programmatically ? It appears that it can be done with the httpApplicationClass ? Any idears ? , I suppose you could get the IIS application to restart on an event in the Global.Asax, But the issue there is, the client build would probably die.
You can make the above cmd into a batch file or whatever, this only works because the MODIFIED Date changes.
BTW This opend up another issue for me... How does one change the modified date of a file with out making some nasty api call My above command works because im basically recreating the file.
a. VBScript cannot change the modified date of a file.
b. Command line cant either (however there is a little program in the windows resource kits that can, it is called "touch"),
c. .Net doesn’t seem to be able to with out making an api call, here the VB...
Public Declare Function SetFileTime Lib "kernel32" _
(ByVal hFile As Long, _
lpCreationTime As FILETIME, _
lpLastAccessTime As FILETIME, _
lpLastWriteTime As FILETIME) As Long
the link http://vbnet.mvps.org/index.html?code/fileapi/filedatetime.htm
Any other Idears on how to Restart an IIS application simply