当前位置: 代码迷 >> Web Service >> webservice找不到种
  详细解决方案

webservice找不到种

热度:263   发布时间:2016-05-02 02:36:49.0
webservice找不到类
[code=C///] <summary>
    /// WebService1 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
    // [System.Web.Script.Services.ScriptService]
    public class WebService1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
 [WebMethod(Description = "登陆")]
        public string tryLogin(string userName, string userPwd)
        {
return "";
}
}#][/code] 

添加引用后,找不到类WebService1 ,倒有一些HelloWorldRequest,HelloWorldReponse之类的,怎么回事?不知怎么用?
------解决方案--------------------
用这个类:WebService1SoapClient 

如果是默认命名空间ServiceReference1,用如下代码调用:

ServiceReference1.Service1SoapClient b = new ServiceReference1.Service1SoapClient();
b.HelloWorld());
b.Close();
  相关解决方案