创建WebService
编写webService代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace MyCalService
{
/// <summary>
/// CalCulService 的摘要说明
/// </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 CalCulService : System.Web.Services.WebService
{
[WebMethod]
public double Add(double a, double b)
{
return a + b;
}
[WebMethod]
public double Sub(double a, double b)
{
return a - b;
}
[WebMethod]
public double Mul(double a, double b)
{
return a * b;
}
[WebMethod]
public double Div(double a, double b)
{
return a / b;
}
}
}
发布webService
将app.publish整个文件夹复制到IIS服务器上,新建文件夹。
然后IIS服务器管理添加网站,进行部署
C#调用webService
参考
https://blog.csdn.net/yexuanbaby/article/details/9029605/
https://blog.csdn.net/yuanguozhengjust/article/details/25747729