c# - Asynchronous webservice in Asp.net -


how can set asynchronous web service in asp.net?

i want call webservice post data database, don't care if response failed or succeeded.

i can use .net 2.0 or 3.5 , can in vb or c#.

when create service reference in visual studio click "advanced..." button , check off "generate asynchronous operations". you'll have option make asynchronous calls against web service.

here's sample of both synchronous , same asynchronous call public web service.

// http://wsf.cdyne.com/weatherws/weather.asmx?wsdl using(var wf = new weatherforecasts.weathersoapclient()) {     // example synchronous call     wf.getcityforecastbyzip("20850");      // example asynchronous call     wf.begingetcityforecastbyzip("20850", result => wf.endgetcityforecastbyzip(result), null); } 

it might tempting call beginxxx , not result since don't care it. you'll leak resources though. it's important every beginxxx call matched corresponding endxxx call.

even though have callback calls endxxx, triggered on thread pool thread , original thread called beginxxx free finish beginxxx call done (it doesn't wait response).


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -