| 好像无参的构造函数是必须地。 1。public class Tool : System.Web.Services.WebService { public Tool(){ InitializeComponent(); } public Tool(string strUrl) { InitializeComponent(); } [WebMethod] public int Insert(string strKey,string strComment) { 。。。} } |
2。 Web References的reference.cs
public class Tool : System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/>
public Tool() {
this.Url = "http://dn2150/NSPTool_WS/Tool.asmx";
}
public Tool(string s)
{
if(s == "")
this.Url = "http://dn2150/NSPTool_WS/Tool.asmx";
else
this.Url = @"http://" + s +@"/NSPTool_WS/Tool.asmx";
}
......
}
博客展示了Web References里reference.cs中Tool类的代码。该类继承自SoapHttpClientProtocol,有两个构造函数,一个默认构造函数设置Url为固定值,另一个构造函数根据传入字符串设置不同的Url。
300

被折叠的 条评论
为什么被折叠?



