When runnig Web Service asynchronously - Exception : System.Net.Sockets.SocketException: The attempted operation is not supported for the type of object referenced. Any idea?

When I try to call web service asynchronousIy I am getting exception from CLR: System.Net.Sockets.SocketException: The attempted operation is not supported for the type of object referenced. (During VS.NET debugging the exception is wrapped as: Unable to connect to the remote server)

When i call the service synchronously it works perfectly.  The service just convert strings to lower case.

I'm using .NET Framework 2.0, here is the source code of form to call the service asynchronously:

 

Imports localhost

Partial

Class ChangeStrings

Inherits System.Web.UI.Page

Dim ws As New MojeStringsService2

Protected Sub btnToLower_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnToLower.Click

Dim ms As New MojeStringsService2

Dim acb As New AsyncCallback(AddressOf ToLowerCallBack)

Dim ar As IAsyncResult = ms.BeginToLowerCase("Transfer this text to LOWERCASE", acb, ms)

End Sub

Private Sub ToLowerCallBack(ByVal ar As IAsyncResult)

Dim ms As MojeStringsService2 = ar.AsyncState

Me.lblResult.Text = ms.EndToLowerCase(ar)

End Sub

End

Class

 

Any Idea where could be a problem? Thanks

0
Sneck
12/28/2006 5:50:36 AM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

0 Replies
802 Views

Similar Articles

[PageSpeed] 27

Reply: