VBAHole22 Posted March 9, 2004 Posted March 9, 2004 I have a web service that I know takes more than an hour and a half to complete. The trouble is that I think my service is timing out before it can complete. I am writing out to a text log while it is working and I can see that it is getting cut off before it finishes. The result is that the web service standard test page goes to a 'page not found' page and I think this short-circuits the service from running. Oddly enough the service still continues to run for a little while after this. My question is what can I do tho avoid this? I have found approximately 8 places where the word timeout is used (machine.config,web.config,on the service object, etc.) which one is the one that is messing me up? You can only set the one in the web.config to the maximum value of an integer, but isn't it in milliseconds? It won't accept -1 for infinity. Is there a way to turn this off totally? -Confused about timeout Quote Wanna-Be C# Superstar
mocella Posted March 10, 2004 Posted March 10, 2004 Note - making the assumption you're on a Win2K machine with this explanation: You can set the IIS timeout to longer than the default (20 minutes) through inetmgr. When you right-click your web-service web and hit properties, you should see the "Directory" tab displayed. Hit the Configuration button and then go to the "App Options" tab. There you can see the Session timeout setting (probably set to 20 minutes, unless your server has been modified from the default settings). Up that to say 40 minutes (to be safe) and give your test another shot. The other methods you mentioned may also fix your problem (web/machine config file, etc), but I've had luck with this sort of thing by changing this setting. Quote
*Experts* Nerseus Posted March 10, 2004 *Experts* Posted March 10, 2004 I would only suggest increasing the timeout to such a large value if the website is ONLY used for this purpose (and not serving webpages). A session is 20 minutes, each page is usually limited to 1 minute (or something similarly small). I'm not sure what you're doing, but I don't think you need/want a webservice for this. If you're kicking off a long process, I would think it would be better to split this into two pieces. The first would start the process and the second would "poll" to see when it's done. While webservers were intended to be stateless (each call is separate from the others), using a "polling" type idea might work great here if you really need this long process exposed as a webservice. If it's just a webpage, then wow... that's a long time to wait :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
VBAHole22 Posted March 10, 2004 Author Posted March 10, 2004 It's an internal process that is not exposed to the public, only serves this purpose and it is all one process that takes that long. I agree with the polling theory, could you give me some more info on that? So if I start the process and then poll for the results is the timeout restriction somehow no longer relevant Quote Wanna-Be C# Superstar
*Experts* Nerseus Posted March 10, 2004 *Experts* Posted March 10, 2004 You would have to change your calling code somewhat and provide two webmethods. The first call to the webmethod would start a process running on the webserver and return. You can use whatever you like for this. You might start a new thread and have it do the actual work, you might launch an EXE that runs asynchronously - your choice. That process (thread or EXE) would need to set some kind of flag on the webserver. If you use a separate thread, it could change some global variable in the website (an Application variable for instance). If you go with an EXE, maybe set a flag in a database or create a file at the end of the process. Again, your choice for whatever makes sense. The client code would do something like: 1. Call first webmethod to start a process 2. Loop for 3 and 4 below 3. Sleep for 1 second (or 1 minute or 10 minutes or whatever you want) 4. Call a second webmethod that checks a "flag" (see above for what that is). You're done when step 4 returns a "true" for the flag. Maybe the webmethod returns a DataSet (if that's what you need) and it's null/Nothing until the process completes. Maybe you just need a true/false returned. Who knows... Again, this is just one way to do it. I'm sure it will spark some ideas. Now, if this is internal only, then why force this to go through a webservice? Why not use remoting? Maybe use COM+? Maybe something else? Why a webservice I wonder? -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
samsmithnz Posted March 10, 2004 Posted March 10, 2004 If its only an internal process, i'd set up a schedule on my Windows box. It defineitly sounds like a webservice isn't right for this... Quote Thanks Sam http://www.samsmith.co.nz
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.