Hi , all
I must call a web mothod synchronously,in this web method , I need do
something asynchronously。My code is below, the BackgroundWorker seemed not
to be able to work in web service project .
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string test()
{
BackgroundWorker oWork = new BackgroundWorker();
oWork.DoWork += new DoWorkEventHandler(a);
oWork.RunWorkerAsync();
return "test return";
}
private void a(object sender, DoWorkEventArgs e)
{
System.Threading.Thread.Sleep(10000);
}
// end . thanks