I found a workaround. It does seem to be because of a call on the UI thread. So what I'm doing now is:
public void CallMethodResultCallbackProxy(IAsyncResult ar) { this.Invoke(new AsyncCallback(this.CallMethodResultCallback) new object[] { ar }); } And this works. But its gross. So somehow "Invoke" knows how to call the object on the UI thread. There has to be a way I can tell the original call to the service to do this. -John > -----Original Message----- > From: The DOTNET list will be retired 7/1/02 > [mailto:[EMAIL PROTECTED]]On Behalf Of John Burkhardt > Sent: Wednesday, June 12, 2002 4:42 PM > To: [EMAIL PROTECTED] > Subject: [DOTNET] Calling Web Services using AsyncCallback > > > I'm trying to do this for the first time. While I can't send the exact > code, here is in essence what I'm doing: > > public void CallMyService() > { > MyService service = new MyService(); > service.BeginCallMethod( > new AsyncCallback(this.CallMethodResultCallback), > service > ); > } > > public void CallMethodResultCallback(IAsyncResult ar) > { > MyService service = (MyService)ar.AsyncState; > string result = service.EndCallMethod(ar); > ... > } > > So the callback happens, and if I set a break point, I can get the result. > But sometime soon afterward I get a "System.IO.IOException" with the > following message: > "Unable to read data from the transport connection" > > Call stack says I'm in System.Net.Connection::ReadCallback() > > This does seem to happen when I try to put the string in a UI control. Is > this not allowed? Is there a way to create the AsyncCallback such that it > will be called on the UI thread? > > Thanks for any help! > > -John > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.