Tuesday, November 27, 2007

Long running web services (.Net WS)

I have some web services that I know are going to take some time to run. They are going to do a lot of stuff so the default timeouts don't apply here. Well, it's actually quite easy to do. First, don't forget to call your web services asynchronously using the provided proxy methods. Then in the web service proxy I affect the Timeout property and set the number of milliseconds I want the timeout to be. You can set -1 for infinite but I wouldn't advise this. Test your server and come up with an expected maximum and add some padding.

On the server side, the default is 110 seconds. By following the provided link, you'll see have to change this setting by adding a line into your Web.Config. Unfortunately you can't set a different timeout for each web method and it will be applied globally to your web service project.

Some help related to the configuration setting: http://msdn2.microsoft.com/en-us/library/e1f13641.aspx

No comments: