Re: Windows Service and WCF Service Problem
John Warner <[email protected]> Thu, 27 Aug 2009 15:25:30 -0400
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Organization | House |
| Message-ID | <080f01ca274c$240dea90$6c29bfb0$@com> |
Thanks for adding the solution to the archive John Warner > -----Original Message----- > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > [email protected]] On Behalf Of Mike Andrews > Sent: Thursday, August 27, 2009 2:49 PM > To: [email protected] > Subject: Re: [ADVANCED-DOTNET] Windows Service and WCF Service > Problem > > After much searching I have finally figured out what I needed to do. > Apparently I needed to put the CallbackBehaviorAttribute attribute on the > Callback class and set the UseSynchronizationContext property to false. Now > all events are raised correctly in the windows service code for the WCF > client. > > Thanks for the suggestions. > > > On Wed, Aug 26, 2009 at 4:48 PM, Mike Andrews > <[email protected]>wrote: > > > After working on this all day I have no more idea about what's going on > > that I did before. > > However, I have used the Windows Debugging Tools and adplus to create a > > dump of the service while it's currently "hanging." > > > > Here's a dump of the relevant WCF thread: > > > > ESP EIP > > 05a1ee1c 7c90e514 [HelperMethodFrame_1OBJ: 05a1ee1c] > > System.Threading.WaitHandle.WaitMultiple(System.Threading.WaitHandle[], > > Int32, Boolean, Boolean) > > 05a1eee8 0364b3ff > > System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[], > Int32, > > Boolean) > > 05a1ef08 0647760d > > > System.ServiceModel.Channels.IOThreadTimer+TimerManager.OnWaitCallba > ck(System.Object) > > 05a1ef3c 06f66f19 > > > System.ServiceModel.Channels.IOThreadScheduler+CriticalHelper+WorkItem. > Invoke2() > > 05a1ef7c 06473948 > > > System.ServiceModel.Channels.IOThreadScheduler+CriticalHelper+WorkItem. > OnSecurityContextCallback(System.Object) > > 05a1ef84 0364fe65 > > System.Security.SecurityContext.Run(System.Security.SecurityContext, > > System.Threading.ContextCallback, System.Object) > > 05a1ef9c 0647390d > > > System.ServiceModel.Channels.IOThreadScheduler+CriticalHelper+WorkItem. > Invoke() > > 05a1efb0 06473890 > > > System.ServiceModel.Channels.IOThreadScheduler+CriticalHelper.ProcessCa > llbacks() > > 05a1efe4 064736ea > > > System.ServiceModel.Channels.IOThreadScheduler+CriticalHelper.Completio > nCallback(System.Object) > > 05a1f010 0647365f > > > System.ServiceModel.Channels.IOThreadScheduler+CriticalHelper+Schedule > dOverlapped.IOCallback(UInt32, > > UInt32, System.Threading.NativeOverlapped*) > > 05a1f01c 7924e6cd > > > System.ServiceModel.Diagnostics.Utility+IOCompletionThunk.UnhandledExce > ptionFrame(UInt32, > > UInt32, System.Threading.NativeOverlapped*) > > 05a1f050 0364cdc4 > > > System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt > 32, > > UInt32, System.Threading.NativeOverlapped*) > > 05a1f1f0 79e71b4c [GCFrame: 05a1f1f0] > > OS Thread Id: 0xd4c (13) > > > > I was hoping that someone here might recognize one or more of these > methods > > and could tell me what direction to go from here. > > > > Thanks, > > Mike > > > > On Wed, Aug 26, 2009 at 9:38 AM, John Warner <[email protected]> > wrote: > > > >> Take a quick look at this: > >> > >> http://www.codeproject.com/KB/dotnet/threadmonitor.aspx > >> > >> In your situation it may make things worse but > >> > >> John Warner > >> > >> > >> > -----Original Message----- > >> > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > >> > [email protected]] On Behalf Of Mike Andrews > >> > Sent: Wednesday, August 26, 2009 10:31 AM > >> > To: [email protected] > >> > Subject: Re: [ADVANCED-DOTNET] Windows Service and WCF Service > >> > Problem > >> > > >> > I doubt it since it's not doing any UI interactions. All ongoing > >> activity > >> > is occurring with WCF and various threads. > >> > Is there a way to tell if you have any threads that are locked because a > >> is > >> > waiting on b is waiting on a? > >> > > >> > On Wed, Aug 26, 2009 at 8:43 AM, Ernst Kuschke <[email protected]> > >> > wrote: > >> > > >> > > Hi, > >> > > I'm not sure what exactly it does, but does your Windows Service > >> perhaps > >> > > need the "Allow service to interact with desktop" permission? > >> > > -- > >> > > Ernst Kuschke > >> > > MVP - C# (South Africa) > >> > > http://dotnet.org.za/ernst > >> > > > >> > > On Wed, Aug 26, 2009 at 3:16 PM, Mike Andrews > >> > > <[email protected]>wrote: > >> > > > >> > > > I'm implementing a windows service and it contains a WCF client to > >> talk > >> > > to > >> > > > a > >> > > > WCF service. The windows service provides drop-folder functionality > >> for > >> > > > files so that the files are picked up and processed using WCF > >> services. > >> > > I > >> > > > uses a process scheduler to allocate multiple files to multiple > >> > > processors > >> > > > to handle these files. It all works fine when I test outside the > >> > > confines > >> > > > of the windows service. However, once executed in the context of a > >> > > windows > >> > > > service it fails when the WCF service issues a callback to it's > >> client > >> > > > (which in this case is the windows service) . Then it just hangs. > >> I'm > >> > > able > >> > > > to break into the code and see that is is the callback in the WCF > >> service > >> > > > that is hanging. No code has been executed in the client (windows > >> > > > service). It could be a permissions issue, but I changed the > >> account of > >> > > > the > >> > > > windows service from LocalSystem to my user account for testing to > >> see if > >> > > > that made a difference and it did not. I'm administrator of the > >> machine > >> > > > I'm > >> > > > executing both the WCF service and the windows service. > >> > > > > >> > > > I'm at a loss here to figure out what's going on with this. This is > >> > > tried > >> > > > and tested code (both the WCF client and WCF service) that has > >> worked > >> > for > >> > > > months now and works outside the context of a windows service. > The > >> > code > >> > > > and > >> > > > examples I'm seeing online are utilizing a windows service as a WCF > >> > > service > >> > > > but this is not my case. Is there something I'm missing here to > >> allow it > >> > > > to > >> > > > work? Some setting I need that I cannot seem to find? > >> > > > > >> > > > Any help would be most appreciated. > >> > > > > >> > > > Thanks, > >> > > > Mike > >> > > > > >> > > > =================================== > >> > > > View archives and manage your subscription(s) at > >> > > > http://peach.ease.lsoft.com/archives > >> > > > > >> > > > >> > > =================================== > >> > > View archives and manage your subscription(s) at > >> > > http://peach.ease.lsoft.com/archives > >> > > > >> > > >> > =================================== > >> > View archives and manage your subscription(s) at > >> > http://peach.ease.lsoft.com/archives > >> > >> =================================== > >> View archives and manage your subscription(s) at > >> http://peach.ease.lsoft.com/archives > >> > > > > > > =================================== > View archives and manage your subscription(s) at > http://peach.ease.lsoft.com/archives =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives