Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2004

Tip: Looking for answers? Try searching our database.

Hosting in a Windows Service, need to block in OnStop until all incoming requests have been processed...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Drew Marsh - 01 Nov 2004 18:06 GMT
Ok, so I'm hosting a SoapReceiver in a custom Windows service. Basically, startup looks like this:

protected override OnStartup()
{
  SoapReceivers.Add(new Uri("soap.tcp://localhost/Test", typeof(MyWebService));
}

Now, shutdown should look something like this:

protected override OnStartup()
{
  SoapReceivers.Remove(new Uri("soap.tcp://localhost/Test"));

 // ... need to wait for all receivers processing messages to finish ...
}

The problem is, before I return from shutdown, I want to make sure all outstanding requests are serviced because I don't want my Windows service terminated until then. Since I don't own the threads that are handling the incoming messages, nor do I ever even see those threads from the Windows service's point of view, what's the recommended approach to do this? Something tells me I'll have to do some custom lower level work to get this to work. :\

TIA,
Drew
Drew Marsh - 01 Nov 2004 18:21 GMT
I wrote:

> Now, shutdown should look something like this:
>
[quoted text clipped - 3 lines]
> // ... need to wait for all receivers processing messages to finish
> ... }

Well, obviously that should be "OnStop"... sorry for the typo.

-Drew

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.