C# - Calling Web Service Invoke

Posted on 2012-09-04
Last Modified: 2012-09-13
Hey guys,

I have an issue that is going on that is driving me pretty much to insanity :).  I have a windows forms based application that stays up running and each night at a certain form timer event it kicks off some processing then after the processing is done I call an async web method that does processing of course.    Almost 50% of the time the web service method ends up stopping and not completing all it's processing.  However, if I manually click the invoke button on the asmx page, it never stops or fails.   I changed all the timeouts to like 'infinite' I tried both sync and async etc. to no avail and I end up babysitting this app every night seeing if it ran.  

My next try was going to be to take the web service method call out of the windows forms application, place it into a console application and scheduling it.  I am trying to mimic exactly what I do when I invoke it manually which really should be what I am doing when calling the method.  Any suggestions or ideas why this would be happening?   It seems like because windows forms is maybe not a certain apartment mode like single or MTA I think it's called may be why this is happening.
Question by:sbornstein2
    LVL 19

    Expert Comment

    by:Shahan Ayyub
    Can you please check in your code that you have no break points and then update web reference in your windows application.

    Also try to write some test messages in a file during the process, so that you may have a track where it takes time.
    LVL 25

    Accepted Solution

    Are there any timeout error or any other errors when it is called from timer ?

    Since it is working from button there shouldn't be any problem in web service. can we see your timer code calling web service ?

    Was there any diff. in creating proxies when you call from a button and timer ?

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now