locked
Long running function in asmx webservice cause operation timeout and service proxy is killed RRS feed

  • Question

  • User719557214 posted

    Hi,

    I am developing an application in C# winforms in which i am using asmx webservices for http communication.I have implemented soket logic on service.One of function in my service is using blocking socket receive but when nothing is receiving on socket then after a certain period of time(120secs) my web service gives a timeout and after that my service instance is destroyed. 

    I have also used async webservice call but still the timeout is occuring.

    If i will use non-blocking socket operation then it will give continous socket exception.

    Is there any better way to do this

    Tuesday, October 1, 2013 2:47 AM

Answers

  • User-742633084 posted

    Hi vaibahvvjy,

    Do you mean that you've opened a socket server on your ASMX webservice server-side for listening to some certain client requests (other than the ASMX webservie's client callers)?

    Since ASP.NET webservice in hosted in IIS worker process, it will shutdown after being idle for certain times. And as you see, for a single webservice class instance, it will be destroyed after not serving client requests for certain times. If you want to have some background work which executes constantly, maybe you should consider some other application such as windows service which open sockets to constantly listen for client connections. For webservice, is it possible that we use WCF instead? WCF is the latest distributed communication component of .NET Framework and it is a super set of ASMX webservice. WCF supports various hosting options like IIS web application, windows service ,console, WPF, etc...

    #Comparing ASP.NET Web Services to WCF Based on Development
    http://msdn.microsoft.com/en-us/library/aa738737.aspx

    #What's the Difference between WCF and Web Services?
    http://www.codeproject.com/Articles/139787/What-s-the-Difference-between-WCF-and-Web-Services

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 2, 2013 1:48 AM

All replies

  • User289622470 posted

    Hi,

       Are you expecting a response from your service. Else you can make your long running service a OneWay method so that you and fire your service and forget. It will avaiod timeout issue since your code will not wait for response.

    Thanks,

    Tuesday, October 1, 2013 5:46 AM
  • User-742633084 posted

    Hi vaibahvvjy,

    Do you mean that you've opened a socket server on your ASMX webservice server-side for listening to some certain client requests (other than the ASMX webservie's client callers)?

    Since ASP.NET webservice in hosted in IIS worker process, it will shutdown after being idle for certain times. And as you see, for a single webservice class instance, it will be destroyed after not serving client requests for certain times. If you want to have some background work which executes constantly, maybe you should consider some other application such as windows service which open sockets to constantly listen for client connections. For webservice, is it possible that we use WCF instead? WCF is the latest distributed communication component of .NET Framework and it is a super set of ASMX webservice. WCF supports various hosting options like IIS web application, windows service ,console, WPF, etc...

    #Comparing ASP.NET Web Services to WCF Based on Development
    http://msdn.microsoft.com/en-us/library/aa738737.aspx

    #What's the Difference between WCF and Web Services?
    http://www.codeproject.com/Articles/139787/What-s-the-Difference-between-WCF-and-Web-Services

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 2, 2013 1:48 AM