首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

#标题党#请教关于WebService的一些有关问题

2012-03-07 
#标题党#请问关于WebService的一些问题!警告,本主题标题违反论坛关于标题党的规定,这一次我帮你改了,下一

#标题党#请问关于WebService的一些问题!
警告,本主题标题违反论坛关于标题党的规定,这一次我帮你改了,下一次就是直接删除。

原标题:困扰菜鸟界多年的问题,欢迎高手解答,这个问题在招聘市场大概值5000。


同时需要说明的是,如果同时有多个问题需要解答,请分别提问。






一个webWeb service的类

C# code
using System;using System.Linq;using System.Web;using System.Web.Services;using System.Web.Services.Protocols;using System.Xml.Linq;using System.Threading;using System.Runtime.Remoting.Messaging;public delegate int Comuter(int a, int b);public delegate void DivCompleteHandler(object sender, DivCompleteEventArgs e);[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService]public class DivideService : System.Web.Services.WebService{    public event DivCompleteHandler OnDivComplete;    public DivideService()    {    }    [WebMethod]    public int Div(int a, int b)    {        Thread.Sleep(10000);        try        {            return a / b;        }        catch (DivideByZeroException e)        {            throw e;        }    }    [WebMethod]    public  void DivAsyn(int a, int b)    {        Comuter computer = new Comuter(this.Div);        computer.BeginInvoke(a, b, new AsyncCallback(Response), null);    }     void Response(IAsyncResult result)    {        try        {            Comuter computer = ((AsyncResult)result).AsyncDelegate as Comuter;            if (null != computer)            {                int consult = computer.EndInvoke(result);                OnDivComplete(this, new DivCompleteEventArgs(consult, null, false, null));            }        }        catch (DivideByZeroException e)        {            OnDivComplete(this, new DivCompleteEventArgs(0, e, true, null));        }        catch (Exception e)        {            OnDivComplete(this, new DivCompleteEventArgs(0, e, true, null));        }    } }


[解决办法]
up
[解决办法]
up
[解决办法]
为5000块标记一下
[解决办法]
标题党
[解决办法]
为5000美元也标记一下
[解决办法]
不会吧!
[解决办法]
UP
[解决办法]
mark
[解决办法]
5000美刀?

热点排行