WCF Client Kills Windows Service Hosting WCF Service

Hi all,

I have a WCF service that does two things:

  1. Returns a DataSet given three string parameters
  2. Returns an ArrayList given 1 string parameter

This WCF service is hosted inside a Windows Service.

My client does this:

  1. Calls the function to return the ArrayList
  2. Iterates through the ArrayList calling the "ReturnDataSet" function with each iteration using the value in the ArrayList to pass to the "ReturnDataSet" function.

My client goes all the way through and everything seems just fine, but when I close the client the Windows Service stops and I have to wait a few minutes to restart it. This seems useless if the client can actually kill the service, that wouldn't happen with ASP.net Web Services so I am kind of sketchy on this whole WCF thing now. It does not seem like the client should have the ability to kill the host. Anyway, I normally don't get any errors but sometimes I do see an errror regarding COM and threading, which is strange because I am not using any COM components or any threading. Can anyone offer some help as to why my client keeps killing my Windows Service that is hosting my WCF service I am happy to post code if anyone wants to see.

Thanks in advance for any help, it is greatly appreciated!



Answer this question

WCF Client Kills Windows Service Hosting WCF Service

  • Brian Jensen

    Does this issue repro if you host the Indigo service inside of a console application instead of a Windows service



  • heavenode

    More info:

    It is not closing the client that is causing my Windows Service to stop, it happens before I even close the client out.

    Another thing I have found out is this:

    ***My client is a WinForms app. I have a folder called "App_Code" which contains my proxies to the services I am using as well as a VB Class called "BLLLayer.vb". I wanted to seperate my business logic and put my code there instead of on the form, but whenver I go to the "BLLLayer" class, my client hangs up and does not give any errors and a few seconds later the Windows service stops. If I take all of the code in my BLLLayer class and place it on the form, the Windows service works fine and does not stop...

    This is driving me completely insane and makes absolutely no sense at all, please help if you can!


  • naila

    Wow, this just gets more and more confusing to me...

    I think I have the root problem narrowed down to the following error:

    ContextSwitchDeadlock was detected
    Message: The CLR has been unable to transition from COM context 0x1a0ea8 to COM context 0x1a1018 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

    I am very new to WCF and .NET in general, so I am probably doing something wrong, however this seemed like it would be a fairly simple service. Again, any help is appreciated.

    Thanks!


  • hanbb

    I have figured 1 thing out: I was able to "work around" the error I was receiving by turning off a couple of exceptions under debug-->exceptions-->managed code exceptions. I don't have my project accessible right now but I will post the exceptions I turned off in order to get past that part (i'm sure this is not the correct way to handle this problem). Now it seems to work fine when I run all of the code on the form, but when I try to run it from the BLLayer class it runs all the way through, and on the "End Sub" the host returns an exception that it is either trying to read or write to protected memory and then the service stops. This doesn't happen when I run the code from the form...very strange! I will get an example together tomorrow when I am at work and send it to your e-mail.

    Thanks for the reply!

    Joe Krueger


  • Dark Yoghurt

    looks like this is VS.NET problem,If you have repro,can you please send me repro,my email id is madhup@microsoft.com

    http://msdn2.microsoft.com/en-us/library/ms172233.aspx

    -Thank you

    Madhu



  • WCF Client Kills Windows Service Hosting WCF Service