WebService timeout - asp.net

I deployed one webservice which calls function which going take more than 5 -6 hours. I am using this webservice on my asp.net page and I am calling this webservice asynchronously. So how should I increase webservice time out?

If you are calling a function that takes 5-6 hours to complete, you may want to re-think your architecture. Would a user sit on the page and wait 5 or 6 hours for your process to finish? Probably not. Maybe you could have your web service set an indicator in a database, xml file or some other data store when it has completed. Then, in your asp.net page, you can click a button or complete some other action to check that indicator to see if the process has finished.

You need to chance the executionTimout in your Web.Config to something large like :
executionTimeout unit is in seconds.
<configuration>
<system.web>
<httpRuntime executionTimeout="21600"/>
</system.web>
</configuration>

If you are ok with all requests in your webservice having a long timeout, you can set
<httpRuntime executionTimeout="300"/>
Under
<system.web>
in your web.config, where 300 is your timeout in seconds
However, as DevSlick answers, you may want to reconsider your archetecture, web services aren't meant for long running tasks, you may want to create a console application that runs on a schedule.

Related

request time out occurs, while executing process

I am developing an application in asp.net 2.0, where i am products details from one site to another. But as there are thousands of products to upload, request time out occurs and the process does not complete.
Can any one help me or suggest me how i can avoid request timeout to occurs in between.
my application is in asp.net 2.0 and using InProc session state.
Thanks in advance.
i also set execution time out in web.config as follows:
<httpRuntime executionTimeout="3500" maxRequestLength="2097151" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true"/>
You can use sessionState. Similar question was answered here.

Does stored procedure execute when ASP.NET application which called it has timed out?

I've a ASP.NET web application which calls a long running stored procedure,
and times out in between, in this scenario will the stored procedure execute. Yes i'm aware that we can increase the timeout duration, but i'm doubtful about the execution of stored procedure
first of all check your stored procedure execute it, if it shows proper result that means it executed successfully. then increase timeout duration
Stored procedure takes time to show result depends upon the data, your logic, etc. but finally it definitely show result.
on application timeout
in web.config
<location path="something.aspx">
<system.web>
<httpRuntime executionTimeout="90"/>
</system.web>
</location>
you can change executionTimeout according to your need
for more information
http://msdn2.microsoft.com/en-us/library/e1f13641.aspx

How to increase the timeout to a web service request?

I have an ASP.NET web application that I can't modify (I only have the binaries). This application connects to a web service and it seems like the connection is closed from the client side (my web app). I have increased the "executionTimeout" in the machine.config of the destination server but my web app seems to still stop after waiting for a while.
Is there a way to increase the timeout time for my web application by simply modifying the web.config? As I said... I can't modify the timeout in the code so my only option would be through config files.
Thanks!
Try if this would work for you.
Firstly, you need to increase the timeout of the executionTimeout attribute of the httpRuntime element. Note that this is mentioned in Seconds unlike the other timeout attributes like the Session timeout and others.
<httpRuntime
executionTimeout="36000"
And moreover, this attribute takes effect only when you set the debug attribute of the Compilation element to false. This is also specified in the MSDN link that you mentioned. Like,
<compilation
debug="false"
../>
But this works in conjunction with the Session timeout. Yes, if the session times out , then an error would be thrown. and it wouldn't wait for the executionTimeout value to take effect. so you also need to set the Session Timeout to a higher value. And note that this is in minutes. which would look like,
<sessionState
mode="InProc"
timeout="360"
...
/>
And note that all of this would be overriden by AppPool recycling process. so you need to set the Idle Timeout value of the Apppool that your website uses to atleast same / higher value than the session timeout.
I found it here http://www.eggheadcafe.com/community/aspnet/17/10111748/how-can-we-increase-the-t.aspx
The default timeout of web application is 90 seconds which is usually more than enough for general purpose use. It is important to note where the timeout is coming from. Is it from the page itself or something in the page that is causing it. In either case, it would appear that the "the page" is timing out.
I stumbled upon this question as my page was timing out too. Found out the exception was coming from SQL (read the the actual error) so it was really SQL problem. Once I knew it, I could easily fix it.
In web.config file
<binding name="endpointname" sendTimeout="00:3:00" />
This will update timeout property to 3 minutes

ASP.NET SOAP call times out after 20 minutes

We have an ASP.Net web service the call to which, due to some bad design, often takes more than 20 minutes to return. We have changed every setting that we can think of, but no matter what we do, we always get a timeout after 20 minutes.
It happens that this web service is a BizTalk orchestration exposed as a web service, but I do not think that is relevant -- the error is an ASP.Net error.
There must be some setting we can change to increase the timeout to more than 20 minutes, but we've exhausted our knowledge. What setting are we missing?
EDIT: Among other setting, we have tried those detailed here: http://weblogs.asp.net/aghausman/archive/2009/02/20/prevent-request-timeout-in-asp-net.aspx, which includes httpRuntime executionTimeout, sessionState timeout and app pool idle timeout.
Thanks,
Jason
Sets the timeout to 60 minutes:
<system.web>
<httpRuntime executionTimeout="3600" />
</system.web>
For .NET 1.0 and 1.1. the default is 90 seconds. For 2.0+ is 110 seconds.
httpRuntime Element (ASP.NET Settings Schema)
Can I just confirm - BizTalk consumes this slow ASMX / WCF service and then re-publishes it (or aggregates this as part of an orch) and it is the consumer which is timing out?
Grasping at straws here, but can you change this consumer to use WCF?
If so, there are more knobs that you can tune
e.g. in the client Bindings
sendTimeout = "00:XX:00"
Also, have you investigated KeepAlives?

How to force a 20 minute time-out for sessions?

I'm very confused when it comes to what actually decides the session time-out.
The web app needs to allow for a 20 minute "idle time" before logging (or throwing) users out. I've tried different setting on both sessionState and Recycle worker processes in IIS. The time-out remains too short and, as far as my quit-n-dirty, primitive tests have shown, a bit random.
I read somewhere that the default time-out is 20 minutes, but in my app it appears to be closer to five. Are there any easy ways to change this? The app is running .NET 3.5 on IIS 6.
EDIT:
I just realized that the Entity Framework might have something to do with the problem, as the user content is held as a context in the entity framework. Is there any time limit for how long an entity is held?
The user will be logged out based on your Authentication settings in the web.config.
The Session timout will be set in your session tag in the web.config.
If they are different then you will see "interesting" results.
http://msdn.microsoft.com/en-us/library/ms972429.aspx
If you look in the web.config you can write some thing like this
<configuration>
<sessionstate timeout="20" />
</configuration>
and there you can set you timeout..
Use the sessionstate timeout. You do not want to use Recycle Worker, as this will recycle all sessions associated with that worker, every N minutes. It's a good idea to set Recycle Worker to a very high value if you are using the session variable.

Resources