By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,201 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,201 IT Pros & Developers. It's quick & easy.

async client calls not completing

P: n/a
Hi...

There are a few questions wrapped up in this, but the main one is that the
WebService.MyMethodAsync() methods that are automatically generated in the
client code by VS 2005 don't seem to be finishing for me.

We have a VS add-in written in .net that used to make a number of database
calls to fill forms. To improve security, we moved the db calls to a web
service and return DataSets for the calls (the result sets are always
reasonably small).

I thought I'd go the extra step and use async calls and compression. I
changed a couple of the calls to

WS.M1Completed += new M1CompletedEventHandler(AsyncM1Completed);
WS.M2Completed += new M2CompletedEventHandler(AsyncM2Completed);
WS.M1Async();
WS.M2Async();
....
private void AsyncM1Completed(object sender, M1CompletedEventArgs e)
{
this.M1DataSet = e.Result;
Debug.WriteLine("Finished M1");
}

private void AsyncM2Completed(object sender, M2CompletedEventArgs e)
{
this.M2DataSet = e.Result;
Debug.WriteLine("Finished M2");
}

The main problem is that even though I see the request completed on the web
service side, AsyncM1Completed() is never called. From all the examples I
found, it looks like this should work. Am I missing something obvious?

The second problem is that M2Async() never seems to get called. I googled
around and found some articles saying that by default ServicePointManager has
default settings that wouldn't allow multiple calls to actually proceed
together. The article recommended

ServicePointManager.UseNagleAlgorithm = false;
ServicePointManager.Expect100Continue = false;
ServicePointManager.DefaultConnectionLimit = 10;

for best performance. I put that in, but am not seeing the 2 async calls
getting fired - still the first one never completing.

I googled around and found the trick that the metadata for the
WebService.EnableDecompression in VS is wrong - the default is false, not
true. I set that, and compression started working.

Any pointers would be appreciated.

Thanks
Mark

Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Mark,

From your description, you're using the async operation of the webservice
proxy methods, however, found that the callback of the async operation
never get executed, correct?

From the code snippet you provided, what you used is the new async model
provided in .net framework 2.0 and the code is quite straightforward. So I
think the code logic is correct, just attach event and then call the
XXXAsync method.

I think currently we may try to isolate the issue first. For example, make
the webservice a very simple helloworld one(with some time delay). And move
the webservice call to console application to watch the behavior.

For the ServicePointManager.DefaultConnectionLimit, it does have a default
2 limit, that's for connection to a given remote server. You can enlarge it
either via the ServicePointManager.DefaultConnectionLimit or via
"system.net" section in app.config file.

Anyway, please feel free to let me know if there is any new finding on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?TWFyaw==?= <mm******@nospam.nospam>
Subject: async client calls not completing
Date: Tue, 10 Jun 2008 11:04:02 -0700
Hi...

There are a few questions wrapped up in this, but the main one is that the
WebService.MyMethodAsync() methods that are automatically generated in the
client code by VS 2005 don't seem to be finishing for me.

We have a VS add-in written in .net that used to make a number of database
calls to fill forms. To improve security, we moved the db calls to a web
service and return DataSets for the calls (the result sets are always
reasonably small).

I thought I'd go the extra step and use async calls and compression. I
changed a couple of the calls to

WS.M1Completed += new M1CompletedEventHandler(AsyncM1Completed);
WS.M2Completed += new M2CompletedEventHandler(AsyncM2Completed);
WS.M1Async();
WS.M2Async();
...
private void AsyncM1Completed(object sender, M1CompletedEventArgs e)
{
this.M1DataSet = e.Result;
Debug.WriteLine("Finished M1");
}

private void AsyncM2Completed(object sender, M2CompletedEventArgs e)
{
this.M2DataSet = e.Result;
Debug.WriteLine("Finished M2");
}

The main problem is that even though I see the request completed on the web
service side, AsyncM1Completed() is never called. From all the examples I
found, it looks like this should work. Am I missing something obvious?

The second problem is that M2Async() never seems to get called. I googled
around and found some articles saying that by default ServicePointManager
has
default settings that wouldn't allow multiple calls to actually proceed
together. The article recommended

ServicePointManager.UseNagleAlgorithm = false;
ServicePointManager.Expect100Continue = false;
ServicePointManager.DefaultConnectionLimit = 10;

for best performance. I put that in, but am not seeing the 2 async calls
getting fired - still the first one never completing.

I googled around and found the trick that the metadata for the
WebService.EnableDecompression in VS is wrong - the default is false, not
true. I set that, and compression started working.

Any pointers would be appreciated.

Thanks
Mark
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.