.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Webservice timeout while calling windows service

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :.NET Framework


We have a .net product built in .Net 2.0.
It consist of three blocks.
First is a asp.net web application which calls webservice which in turn call a windows service to get results from database.
Our problem is that windows service is taking time to get results from database because of which timeout is occuring.

Now we have already set timeout property in web application while calling web service through proxy. However, we could not find how to set timeout property for webservice(This will stop webervice from timeout before windows service send back the result).

If somebody have done it, please help


View Complete Post

More Related Resource Links

Intermittent timeout calling ASMX web service yet Upload data transfer completes OK

I'm calling my webservice from a web page and getting a timeout despite setting very high values in my web.config files. This occurs intermittently when the file is usually pretty large but yet the file is still getting uploaded completely (as if the timeout DID NOT occur). Here is a function in my .aspx file which calls my ASMX proxy class:
private void UploadFile(HttpPostedFile postedFile, string fileNameOnly) 
    // create an instance of the proxy class to talk to our service; calling it client: 

Protocol error (503 Service unavailable) when calling webservice from Win2003


I'm receiving a 503 Service unavailable -error from a webservice when calling client is on WinServer 2003.

Scenario: Windows Forms (.NET 4) application calls remote webservice on windows server 2003 to fetch information.
In some cases it takes a long time for the WebService to get the informationa (long running database procedure) so the client waits for the response.
WebService timeouts are set at +30min.

The setup has worked fine for some time now but recently we discored that a particular long running request began to fail.
The Windows Forms client fails with a 503: Service Unavailable -error and ProtocolError after just a couple of minutes into waiting for the response.

We did some testing and this error occurs if the client application is installed on a Windows Server 2003 box.
If we do the same test with the client application installed on a Windows 7 box it works without errors.

It seems that it has something to do with Windows 2003 but how to debug this?
Anyone have any ideas what could be the problem?


WCF REST webservice hosted in a windows service


Hi, I created a WCF REST service which had a method "Result":



public interface IService


   [OperationContract(Name =  "Result")]

   [WebGet(UriTemplate = "/")]

   string Result();


When I went to the default page http://localhost:portnumber/Service.svc it would display the string returned by Result().


I then wanted to host the WCF service in a Windows Service. The service is running fine and I can browse to the baseAddress. However in this setup it displays the default "You have created a service" page and doesn't execute the method returning the string.


I'm not even sure if this is possible. In summary is it possible to how a WCF REST service in a Windows Service and get it to respond to HTTP GET requests?


Can anybody suggest a solution?





Windows service calling web services asynchronously.


I have followed the code example from http://msdn.microsoft.com/en-us/magazine/cc163821.aspx#S4 to create a windows service that runs web services at scheduled intervals and have hit some scaleability challenges.

Background and disclaimer.

This is my first attempt at a windows service running scheduled web services, for the most part it has been working fine for months until introducing log running tasks.

OS: Windows Server 2003

.NET Framework 3.5

IIS Version 6

Several of the web services I am calling via the windows service task scheduler are long running, 20-30 minutes in duration, and have caused me to fight through a myriad of timeout issues

Managed windows service startup timeout


When a PC boots  we have the problem that the services, that our product relies on, often fails to start.

The services are written in managed C# code using .Net 4 framework. When the services fails to start the Main function is never executed i.e. the Service Control Manager kills the process while the process is initializing, but before the first line of our code is excuted.

Our guess is that it is the initialization of the .Net runtime that takes too long time as we can solve the problem by increasing the value of [HKEY_LOCAL_MACHINE \System \CurrentControlSet \Control] ServicesPipeTimeout.

Does anyone know if we can solve this without setting the ServicesPipeTimeout? Or do you think that it is OK to increase the ServicesPipeTimeout to 60 seconds or more, when installing our product?

 I am putting the question under CLR since there is not really a better forum? Do you have an idea for which forum to put it in?

Thanks ArildR



Workflow + WCF WebService in a windows service executable

I need to create a windows service and will expose service functions via WCF.   The work we need to do is very workflow oriented.  So I was thinking we could host the workflow runtime, and let a workflow listen for WCF requests.    Everything I've found on the net implies that a workflow can respond to webservices if it is "published as a webservice".   I cannot do that....

I've thought about creating some custom activities thats listen for an event from ServiceHost object.....my question is, does that work ok?  any one try this or have thoughts on how to achieve this?
Senior Architect - Miles Consulting

calling and hosting WCF services from windows service


I have 2 windows services. Both hosting their own WCF service and it works fine.

Now one windows service (let call it the second) does need some information from the first windows service.
So I make the second dependend on the first.
This all works fine untill the second windows service starts (it started the first automatically because of dependency).
I make a call to a wcf method (even before ServiceBase.Run) from inside the second windows service towards the first. This will timeout.

I have tackled this problem by making the wcf call after ServiceBase.Run (in the OnStart method) so it looks like the program is not possible to make a wcf call before it is hosted itself (am I right?).

However when I reboot the computer the second service fails to start (startup type is automatically and the first service is started first).
The dependend service fails to start, after that, when I start it manually it will succeed

How do I make this communication work

Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

Calling webservice from the server


I have a sample web service and aspx file. I deployed them to an existing website that contains classic asp files.

web-service: --- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "http://localhost/MyWebServices/")] public class MembershipRegisWebService : System.Web.Services.WebService { public MembershipRegisWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World."; } }

aspx.cs file: --- using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; public partial class CallWebService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MembershipRegisWebService mrWs = new MembershipRegisWebService(); Response.Write("Calling web service:" + mrWs.HelloWorld()); } }

It runs locally, but it shows an error when running it from the server:

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the follow

Web Service Workflows: Deploy Distributed Business Processes With Windows Workflow And Web Services


Due to the distributed nature of a business process it makes sense for a workflow to be deployed as a distributed application. See how Windows Workflow and Web Services hold the key.

Israel Hilerio

MSDN Magazine October 2006

Service Station: Serialization in Windows Communication Foundation


Windows Communication Foundation supports several serialization mechanisms and provides a simple, interoperable foundation for future service-oriented applications. Here Aaron Skonnard explains it all.

Aaron Skonnard

MSDN Magazine August 2006

Windows Services: New Base Classes in .NET Make Writing a Windows Service Easy


Windows services are applications that run outside of any particular user context in Windows NT, Windows 2000, or Windows XP. The creation of services used to require expert coding skills and generally required C or C++. Visual Studio .NET now makes it easy for you to create a Windows service, whether you're writing code in C++, C#, or Visual Basic. You can also write a Windows service in any other language that targets the common language runtime. This article walks you through the creation of a useful Windows service, then demonstrates how to install, test, and debug the service.

Ken Getz

MSDN Magazine December 2001

Calling a webservice in MVC using jquery works on dev box not prod box


I have a webservice that is part of the MVC project.  I am using VS 2010 MVC 2.0 on Windows 7.  When I run the web application locally the webservice call works flawlessly, however on the prod box using  2008 upgraded with asp.net 4.0 it fails.

I get an error "The controller for path '/services/traxservices.aspx/upDateCustomer' was not found or does not implement IController. "

Is there some type of issue with the settings in the global.ascx or in IIS that I am missing?


Any help would be appreciated.

VS2005 calling VS2010 asmx service returns empty string


Anyone have any experience with this?

We are using VS 2005 for the front end, and vs 2010 for the web services part (asmx), not wcf yet.


Web service works just like the vs2005 when run locally, no problems.


Connecting to it from a test app returns an empty string. Connecting to a 2005 app doesn't!

Anyone run into this before or have a suggestion? Surely vs 2005 can connect to web services from a later version?






Getting AppDomain.UnhandledException event to work in a Windows Service

Nearly every forum thread I have found on "catching unhandled exceptions in a service" seems to end up where I am.  The supposed solution is the use of the AppDomain.CurrentDomain.UnhandledException event.  But it doesn't work for someone, who then asks why and gets no answer.  Same for me; I can't get the event to happen.  It's as if I need the ServiceProcess version of Application.SetUnhandledExceptionMode(), which doesn't exist. For diagnosing this, I start a timer in a child object of the service and then throw an exception in the timer event handler.  Simple enough to simulate the real situation.  I have tried subscribing to the UnhandledException event in at least a half dozen locations throughout the service, from the Program that runs ServiceBase.Run() to the constructor of the object that owns the Timer, but it never catches this exception. The VS debugger recognizes that the forced exception is unhandled and takes me to the place where is thrown, letting me know it is an unhandled exception. Why doesn't my handler catch it?  Running without the debugger, the exception throws, the timer thread crashes, the service continues merrily along, and nothing gets logged anywhere.  That is NOT the result I need.  What are the people for whom this works doing that I am not doing? How can I at least get the offe

Windows Identity Foundation Security Token Service can't stay logged in

I'm using the Windows Identity Foundation **(WIF)** Security Token Service **(STS)** to handle authentication for my application which is working all well and good. However I can't seem to get any long running login with the STS. From my understanding I shouldn't care about the client tokens at the application level since they can expire all they want to and it should redirect me to the STS and as long as they're still logged in on the STS it should refresh their application token. Yet it doesn't seem to want to keep them signed in. Here's what occurs in my login.aspx on the STS var cookie = FormsAuthentication.GetAuthCookie(userName, persistTicket); if (persistTicket) cookie.Expires = DateTime.Now.AddDays(14); Response.Cookies.Add(cookie); var returnUrl = Request.QueryString["ReturnUrl"]; Response.Redirect(returnUrl ?? "default.aspx"); Which was taken almost directly from existing application using normal Forms Auth. From my web.config <authentication mode="Forms"> <forms loginUrl="Login.aspx" protection="All" timeout="2880" name=".STS" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" /> </auth

Cash Drawer - Method Open threw an exception - Windows Service

Hi All, I'm getting the following exception while calling Open method of Cash Drawer object. Method Open threw an exception.  Could not read the device name key's default value, or could not convert the Programmatic ID it holds into a valid Class ID. Code:   class Class1 { CashDrawer _uniCashDrawer1 = null; DeviceInfo cashDrawerDevice1 = null; PosExplorer posExplorer = new Microsoft.PointOfService.PosExplorer();   public void ClaimCashDrawer() { cashDrawerDevice1 = posExplorer.GetDevice("CashDrawer", "testDrawer"); if (cashDrawerDevice1 != null) { _uniCashDrawer1 = posExplorer.CreateInstance(cashDrawerDevice1) as CashDrawer; if (_uniCashDrawer1 != null) { _uniCashDrawer1.StatusUpdateEvent += new StatusUpdateEventHandler(UniCashDrawer1_StatusUpdateEvent); _uniCashDrawer1.Open(); _uniCashDrawer1.Claim(0); _uniCashDrawer1.DeviceEnabled = true; } } } }   Tha above code works fine if you put the code in WindowsApplication in all POS systems. The same is working if you put the code in Windows Service in all other POS systems. The same is not working if you put the code in Windows Service in Aures Galeo POS systems.  Thanks in advance. Ramakrishnan S
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend