简体   繁体   中英

Cancelling call to web-service from application

I have a winform app that has two buttons GetData and Close. On GetData I retrieve some data from a web-service whereas Close just closes the dialog. I am calling the web-service on a separate thread. This thread is class instance variable. If getting data from web-service is taking too long and user click on close, I want to cancel that call to web-service and just close the dialog.

What is the best way of cancelling that call to web-service, by just calling abort on thread instance? Any other idea/best practices are welcome too.

You can not cancel it. Once the webservice call is placed then it will get executed even if the calling thread is aborted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM