none
Windows service getting stopped abruptly RRS feed

  • Question

  • Hi,

    I have a windows service application which pings server continuously every 10 secs and downloads files from the server.

    Recently, I have faced an issue where suddenly service is getting stopped and I cannot see anything in my log. My code has proper exception management and there is very less chance a error is not caught.  

    Is there any other way to find out whats wrong and the rootcause for this behaviour.

    I have figured out that this is the exception that I'm getting in Event viewer.

    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.Net.WebException
    Stack:
       at System.Net.ServicePointManager.FindServicePoint(System.Uri, System.Net.IWebProxy, System.Net.ProxyChain ByRef, System.Net.HttpAbortDelegate ByRef, Int32 ByRef)
       at System.Net.HttpWebRequest.FindServicePoint(Boolean)
       at System.Net.HttpWebRequest.get_ServicePoint()
       at System.Net.AuthenticationState.PrepareState(System.Net.HttpWebRequest)
       at System.Net.AuthenticationState.ClearSession(System.Net.HttpWebRequest)
       at System.Net.HttpWebRequest.ClearAuthenticatedConnectionResources()
       at System.Net.HttpWebRequest.Abort(System.Exception, Int32)
       at System.Net.HttpWebRequest.AbortWrapper(System.Object)
       at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

    Event Xml:

    Thanks in advance.


    Navyatha


    • Edited by Navyatha Thursday, January 16, 2014 1:14 AM
    Wednesday, January 15, 2014 7:35 AM

All replies

  • Hi Navyatha,

    Please have a look at the following links to know how to debug Windows Service, and then post something more information about this issue here so that we can help you.

    http://msdn.microsoft.com/en-us/library/7a50syb3(v=vs.110).aspx.

    http://stackoverflow.com/questions/5156427/how-do-you-debug-a-windows-service.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 16, 2014 3:25 AM
    Moderator
  • Hi Hetro wong,

    I have tried debugging, but it didn't help.

    I found this in my research:

    http://stackoverflow.com/questions/15363536/setting-httpclient-to-a-too-short-timeout-crashes-process

    Please let me know your comments on this.

    Thanks.


    Navyatha



    • Edited by Navyatha Wednesday, January 22, 2014 11:14 AM
    Wednesday, January 22, 2014 11:13 AM
  • Hi Navyatha,

    If conditions permit, I think you could build a virtual machine and test the KB.

    I know there are many reasons of this kind of issue, such as network resource or the large response. Please try increasing the HttpWebRequest’s Timeout property.

    We can see the error was thrown by “at System.Net.ServicePointManager.FindServicePoint(System.Uri, System.Net.IWebProxy, System.Net.ProxyChain ByRef, System.Net.HttpAbortDelegate ByRef, Int32 ByRef)”. It means the system tried to connect to server, but failed. I think you should make sure the remote server is reachable.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, January 24, 2014 6:05 AM
    Moderator
  • Hi Hetro wong,

    Thanks for your response. I'll definetely try to build a virtual machine and test the service with less resources.

    I understand that the error is thrown while service is trying to reach the server. Also please note that server is up and running and is reachable the time when we faced this issue multiple times.

    We are also handling exceptions thrown while reaching the server using httpwebrequest.

    If there is any timeout error while trying to reach the server, I'm getting timeout exception which is handled properly in the code. Currently timeout value is 2 min in my code and also timeout shall be used only for HttpWebRequest.GetResponse() and HttpWebRequest.GetRequestStream() methods. Correct me if I'm wrong. But this seems to be an exception while trying to reach the server during abort or request close method.

    Can you let me know is this exception getting generated while invoking abort or close method of httpwebrequest or is there any other case where we get this exception?

    Thanks.


    Navyatha


    • Edited by Navyatha Friday, January 24, 2014 6:51 AM
    Friday, January 24, 2014 6:17 AM