![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I'm trying to launch several async calls for different methods of a web service, but I get this error when i'm trying to read the result (There was an error during asynchronous processing. Unique state object is required for multiple asynchronous simultaneous operations to be outstanding.). I read the post at http://forums.microsoft.com/MSDN/Sho...79895&SiteID=1, and I get the same error, but I have async calls to different web service methods. What should I do? |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Thanks for answering John, but I already did that. Here's how my code looks like: languageReady = false; contestReady = false; usercontrolsReady = false; backendService.GetControlsConstantsCompleted += new GetControlsConstantsCompletedEventHandler(backendS ervice_GetControlsConstantsCompleted); backendService.GetControlsConstantsAsync(1); backendService.GetContestIdByCodeCompleted += new GetContestIdByCodeCompletedEventHandler(backendSer vice_GetContestIdByCodeCompleted); backendService.GetContestIdByCodeAsync((string)Req uest.QueryString["contest"], 1); backendService.GetLanguageIdByCodeCompleted += new GetLanguageIdByCodeCompletedEventHandler(backendSe rvice_GetLanguageIdByCodeCompleted); backendService.GetLanguageIdByCodeAsync((string)Re quest.QueryString["language"], 1); ((string)Request.QueryString["language"]); while (!(languageReady && contestReady &&usercontrolsReady)) { } Session["BackendContestData"] = backendService.GetPublicContestData((int)Session["ContestId"]); backendContestData = (PublicContestData)(Session["BackendContestData"]); So I have 3 web services methods which are called async, and I want to wait until I get the response from all the 3 of them (I set the bool values to true in the event handler for the completion of the web service methods). As you can see all 3 methods are called with the same unique user state (1) and if I do this I get the error inside the event handlers. If I set each method a different unique user state (1, 2, 3 for example) then my events are not fired. |
#5
| |||
| |||
|
|
"Stefan Filip" <StefanFilip (AT) discussions (DOT) microsoft.com> wrote in message news:6CD5CF8F-E949-4A6C-809C-878710D981B6 (AT) microsoft (DOT) com... Thanks for answering John, but I already did that. Here's how my code looks like: languageReady = false; contestReady = false; usercontrolsReady = false; backendService.GetControlsConstantsCompleted += new GetControlsConstantsCompletedEventHandler(backendS ervice_GetControlsConstantsCompleted); backendService.GetControlsConstantsAsync(1); backendService.GetContestIdByCodeCompleted += new GetContestIdByCodeCompletedEventHandler(backendSer vice_GetContestIdByCodeCompleted); backendService.GetContestIdByCodeAsync((string)Req uest.QueryString["contest"], 1); backendService.GetLanguageIdByCodeCompleted += new GetLanguageIdByCodeCompletedEventHandler(backendSe rvice_GetLanguageIdByCodeCompleted); backendService.GetLanguageIdByCodeAsync((string)Re quest.QueryString["language"], 1); ((string)Request.QueryString["language"]); while (!(languageReady && contestReady &&usercontrolsReady)) { } Session["BackendContestData"] = backendService.GetPublicContestData((int)Session["ContestId"]); backendContestData = (PublicContestData)(Session["BackendContestData"]); So I have 3 web services methods which are called async, and I want to wait until I get the response from all the 3 of them (I set the bool values to true in the event handler for the completion of the web service methods). As you can see all 3 methods are called with the same unique user state (1) and if I do this I get the error inside the event handlers. If I set each method a different unique user state (1, 2, 3 for example) then my events are not fired. Sorry for not following up sooner, but aren't you the poster who got an error complaining that you can't use the same state in multiple calls? Yet here, you're telling me that you use the same state, and you get an error. What did I miss? What happens if you try something like: object state1 = 1; object state2 = 1; object state3 = 1; and pass state1, etc. as the state? Perhaps you're not really passing the number 1? Are you passing some other value type? -- -------------------------------------------------------------------------------- John Saunders | MVP - Windows Server System - Connected System Developer |
#6
| |||
| |||
|
|
Hello, I'm trying to launch several async calls for different methods of a web service, but I get this error when i'm trying to read the result (There was an error during asynchronous processing. Unique state object is required for multiple asynchronous simultaneous operations to be outstanding.). I read the post at http://forums.microsoft.com/MSDN/Sho...79895&SiteID=1, and I get the same error, but I have async calls to different web service methods. What should I do? Thanks |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |