好像无参的构造函数是必须地。 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://localhost/NSPTool_WS/Tool.asmx";
}
public Tool(string s)
{
if(s == "")
this.Url = "http://localhost/NSPTool_WS/Tool.asmx";
else
this.Url = @"http://" + s +@"/NSPTool_WS/Tool.asmx";
}
......
}