如果在项目中有一个service1.asmx文件
该文件中有一个以下方法:
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}还有另一个WebForm窗体WebForm1
如何在该窗体中获得service1.asmx文件HelloWorld()方法的返回值
WebForm窗体的代码怎么写?需要using到什么?
如果service1.asmx这个web服务部署到其它服务器上,也就是不和窗体WebForm1在一个工程项目中,那代码应该怎么写?
该文件中有一个以下方法:
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}还有另一个WebForm窗体WebForm1
如何在该窗体中获得service1.asmx文件HelloWorld()方法的返回值
WebForm窗体的代码怎么写?需要using到什么?
如果service1.asmx这个web服务部署到其它服务器上,也就是不和窗体WebForm1在一个工程项目中,那代码应该怎么写?
using System.Web.Services;
public class MathService : WebService { [WebMethod]
public float Add()
{
return "Hello World"; }
XML Web 服务文件以 .asmx 文件扩展名保存。与 .aspx 文件一样,这些文件也在服务请求发出(后面的请求由缓存的预编译 type 对象服务)时由 ASP.NET 运行库自动编译。对于 MathService 的情况,已在 .asmx 文件本身中定义了 WebService 类。注意,如果浏览器请求 .asmx 文件,ASP.NET 运行库将返回描述 Web 服务的 XML Web 服务帮助页。
}
我现在的问题是如何在其他webform(如webform1.aspx)上获得service1.asmx文件HelloWorld()方法的返回值?