0

I have a webservice running on an IIS server using c# and a asmx file.

The Service is able to upload files requested by users to a ftp-server for them to temporarily view.

The temporary folders are cleared on logout and such things... but if the user does not log out and just closes the tab or the browser in general, the files will stay at the FTPserver...

I wanted to make a "garbagecollector" function wich will clean up these files, or any files older than XXXXX.

So, since the Webservice will timeout after the amount of minutes specified in the IIS config, I can't run a timer to do this.

Is there any event that is triggered when the webservice is about to "shut down" (time-out)?

I was googling like crazy... didn't find anything useful (or I was googling wrong)...

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Qlonq
  • 1
  • 1
  • 1
  • 3
    Welcome to Stack Overflow! ASMX is a legacy technology, and should not be used for new development. WCF or ASP.NET Web API should be used for all new development of web service clients and servers. One hint: Microsoft has retired the [ASMX Forum](http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/threads) on MSDN. – John Saunders Nov 15 '13 at 14:49
  • 1
    Use the right tool for the job. Create a Windows service to run the cleanup, or write a console application that will run by the Windows Task Scheduler. – John Saunders Nov 15 '13 at 14:50
  • well, thanks for the quick reply. But as this is a "job" I am not the one to choose the technology used ;) I'll give it a try and ask for permission for task scheduler to clean up! – Qlonq Nov 15 '13 at 14:52
  • As it's a "job", you are also expected to use the correct tool, and not make things worse by ramming a square peg into a round hole. – John Saunders Nov 15 '13 at 14:54
  • Application_Start and Session_End are good places to do this sort of thing – bmm6o Nov 15 '13 at 19:45

0 Answers0