473,486 Members | 1,850 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Server-Side Asynchronous Web Method help

Hi, excuse the long post and plz read on :)

My web application needs to upload a .csv & .zip file, as well as,
import the .csv into a (Sql2000) table and unzip the .zip file to a
directory on the web server every day. Since I don't want the
application to time-out, I'm putting all this into a Server-Side
Asynchronous Web Method.

I've starting out by writing this test web service:

public delegate string GetListingsAsyncStub(int DelayInSeconds);

public string GetListings(int DelayInSeconds)
{
if (DelayInSeconds > 0)
{
System.Threading.Thread.Sleep(DelayInSeconds * 1000);
}
return "Success";
}

public class MyState
{
public object previousState;
public GetListingsAsyncStub asyncStub;
}

[WebMethod]
public IAsyncResult BeginGetListings(int DelayInSeconds, AsyncCallback
callback, object asyncState)
{
GetListingsAsyncStub stub = new
GetListingsAsyncStub(GetListings);

MyState ms = new MyState();
ms.previousState = asyncState;
ms.asyncStub = stub;

return stub.BeginInvoke(DelayInSeconds, callback, ms);
}

[WebMethod]
public string EndGetListings(IAsyncResult asyncResult)
{
MyState ms = (MyState)asyncResult.AsyncState;
return ms.asyncStub.EndInvoke(asyncResult);
}
And this is in my Page_Load page that will be scheduled to run:

string ReturnValue;
IAsyncResult AsyncResult;

ImportService service = new ImportService();

Response.Write("Started: " + DateTime.Now.ToString() + "<br>");
AsyncResult = service.BeginGetListings(10, null, null);

ReturnValue = service.EndGetListings(AsyncResult);
Response.Write("Ended: " + DateTime.Now.ToString() + "<br>");

Response.Write(ReturnValue);
What I'm seeing is, the page waits for the ten seconds to load. Does
ne1 see the obvious(to you) reason?

TIA,
~Gordon
Nov 17 '05 #1
0 955

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2030
by: Philip Trim | last post by:
General Brief: 3 SQL Servers as MS SQL Server 2000 Standard Edition with Service Pack 3 All using FTP for snapshots All Servers are both Publishers and Distributors. Server A has the correct...
2
2133
by: Jay Chan | last post by:
We have just installed a SQL Server 2000 (SP 3A) onto a computer that has Windows-2003 Server on it. Now, we cannot get access to that database server from other computers. Seem like this may be an...
3
3263
by: Vincento Harris | last post by:
Sql Server 7 Standard Edition My Server was renamed and the normal steps of reinstalling and running sp_dropserver and sp_addserver were followed. Everything seems to work fine but jobs from the...
2
4273
by: Robert M. | last post by:
Information: Server A: SQL Server 2000 Enterprise Edition. OS is Windows 2003 Server Enterprise Edition. SQL Service pack is 3a. Member of domain ABCDomain. Server A is going to function as a...
2
4292
by: J.Beaulieu | last post by:
Hi I'll have probably to use sql server soon but prior to that I have a question concerning priviledges and security. Is it possible for someone to do like in access, ie creating a db/table...
2
2067
by: heyitsme_ryan | last post by:
Ei guys I’m Ryan from Philippines, I need your advice and recommendations about Windows 2003 Server and SQL Server 2000 installation. Well, here’s the scenario. First is for windows 2003 server:...
0
4506
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
22
3236
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
17
9172
by: Danieltbt05 | last post by:
just installed SQL server 2000 and using my client , i can't locate the server. I used SQL query analyzer to search but no servers were found. Error message is as below Server : Msg17,level...
10
16187
by: sara | last post by:
Hi All, I was able to connect to MS SQL Server 2005 on my computer but after a while I can not. When I want to connect to it using MS SQL Server Management Studio I got this error: An error...
0
7094
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6839
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5427
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.