嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
C#建立WebService就不多说了,百度一下。
本例的服务是接收发来的文字信息保存,并发送给用户。
WinForm发送文字信息,并每2秒刷新从服务取得的文字信息。
1、配置好IIS,指向TentWebService.asmx文件夹和文件,百度IIS配置;
2、编写修改完TentWebService.asmx,点右键“发布”;
3、WinForm里点右键选择“添加”、“服务引用”,指向IIS的地址,点击“转到”,再输入“命名空间”。
WEB部分
namespace TentServeric
{
/// <summary>
/// TentWebService 的摘要说明
/// </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 TentWebService : System.Web.Services.WebService
{
[WebMethod]
public void Total_Message (string message)
{
Msglist.msg = "{$}" message;
}
[WebMethod]
public string Send_Message ()
{
string send = Msglist.msg;
return send;
}
}
}