关于WebService的异步调用

xinxincao 2003-11-11 06:51:17
看了一点资料,还是很糊涂,有以下问题:

1。我有多个参数,怎么传递?
Mothod1(int int1,string string1,out int int2,out string string2)
beginMothod1()参数怎么写呀?
2。到底用不用自己去定义BeginMothod1和EndMothod1函数?
看微软的帮助怎么说要自己定义呢?


能提供一些好的资料也非常感谢,我在网上找到的相关资料不是很多!
...全文
142 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
KK4 2003-11-12
  • 打赏
  • 举报
回复
http://www.microsoft.com/china/msdn/library/dnservice/html/service10012002.asp
gOODiDEA 2003-11-12
  • 打赏
  • 举报
回复
参考:

private void button1_Click(object sender, System.EventArgs e)
{
string wsCallLabel = (++wsCallCount).ToString("D4");
try
{
localhost.Service1 ws = new localhost.Service1();
IAsyncResult ar;

if (radioButtonSync.Checked)
{
listBox1.Items.Add( ws.DoSomething(wsCallLabel, (int) numericUpDown1.Value ));
}

if (radioButtonWaitHandle.Checked)
{
ar = ws.BeginDoSomething( wsCallLabel, (int) numericUpDown1.Value, null, null);
Color orgColor = this.BackColor;
int colNum = 0;
while (! ar.AsyncWaitHandle.WaitOne(10, false))
{
if (colNum == 254)
colNum = 0;
else
colNum++;
this.BackColor = Color.FromArgb(100, colNum, 100);
this.Refresh();
}
this.BackColor = orgColor;
listBox1.Items.Add(ws.EndDoSomething(ar));
}

if (radioButtonCallBack.Checked)
{
AsyncCallback cb = new AsyncCallback(WsCallback);
ar = ws.BeginDoSomething( wsCallLabel, (int) numericUpDown1.Value, cb, ws);
}

}

catch(System.Exception exception)
{
listBox1.Items.Add(exception.Message);
}

}
rgbcn 2003-11-11
  • 打赏
  • 举报
回复
http://www.microsoft.com/china/msdn/library/dnservice/html/service10012002.asp
阿拉丁 2003-11-11
  • 打赏
  • 举报
回复
异步很烦 调试的时候回头晕 为什么不用同步?
sunxiaoli 2003-11-11
  • 打赏
  • 举报
回复
感兴趣

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧