Calling Web Service Asynchronously


M

Mike C#

Hi all,

Having an issue. I created a simple web service and a proxy class. I'm
calling the web service asynchronously (from an ASP.NET page) using the
Begin... and End... methods of the proxy class. It appears to work properly
until I get to the callback function. As soon as I try to cast the
IASyncResult and call the End... method it stops executing at the CType
function and exits the callback procedure. The Web Service is very simple -
basically it has one method called "GetSingle" that returns a string. The
proxy class adds the BeginGetSingle and EndGetSingle methods. Here's the
code for the callback:

Private Sub Callback(ByVal iar As IAsyncResult)
Dim p As localhost.AsyncWebSvc = CType(iar, localhost.AsyncWebSvc)
' It never gets to this line, where I would retrieve the results. The
line above
' stops the processing for some reason. If I put a breakpoint on the
line below
' it never gets to it.
Dim s As String = p.EndGetSingle(iar)
Dim status As String = "Done"
End Sub

Any help is appreciated. Thanks!
 
Ad

Advertisements

M

Mike C#

OK I think I resolved that particular issue. But now I have another. When
I call my Web Service synchronously, or asynchronously 2, 3, or 4 times, it
works fine. When I try to call it asynchronously 8 times, however, I get a
"(403) Forbidden" error. I'm running it all on my localhost IIS server and
ASP.NET installation. Does anyone know why this might happen? Is there a
setting somewhere I need to adjust maybe?

Thanks
 
M

Mike C#

Mike C# said:

Some more info. - the Web Service is using HttpWebRequest to POST to, and
retrieve data from, an ASPX page on my localhost web server. With up to 4
asynchronous calls, it works. The exact cut-off appears to be at 5
asynchronous calls, where I get the following error message:

"The remote server returned an error: (403) Forbidden."

Also I get a pop-up message with the following error:

"An unhandled exception of type 'System.IO.IOException' occurred in
system.dll
Additional information: Unable to read data from the transport connection."

I assume the second is probably a result of the connection being closed
because of the (403) error, although I could be wrong. Any ideas are
appreciated. Thanks!
 
J

John Saunders

Mike C# said:
Some more info. - the Web Service is using HttpWebRequest to POST to, and
retrieve data from, an ASPX page on my localhost web server. With up to 4
asynchronous calls, it works. The exact cut-off appears to be at 5
asynchronous calls, where I get the following error message:

"The remote server returned an error: (403) Forbidden."

You can get this error when you have too many connections open in IIS.

John
 
M

Mike C#

John Saunders said:
You can get this error when you have too many connections open in IIS.

That appears to be the problem :( Is it too many connections from one
client? What's the best way to perform multiple asynchronous calls from
ASP.NET? Or is it even possible?
 
J

John Saunders

Mike C# said:
That appears to be the problem :( Is it too many connections from one
client? What's the best way to perform multiple asynchronous calls from
ASP.NET? Or is it even possible?

If you're running IIS on Windows XP, then it's meant to be an upper limit.
It's a license thing.

Are you calling Dispose on your proxy objects? If not, then you're leaving
the connections open.

John
 
Ad

Advertisements

M

Mike C#

John Saunders said:
If you're running IIS on Windows XP, then it's meant to be an upper limit.
It's a license thing.

Are you calling Dispose on your proxy objects? If not, then you're leaving
the connections open.

John

Actually running it on Windows Server 2003, and properly disposing of all
IDisposable objects. I've been told there may be a registry setting that
needs to be modified and I'm trying to find info. on that to give it a
shot... We'll see... Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top