第一步.编写WebServices服务方法 [WebMethod] public void PostJson(string str, string bb) { Dictionary<string, object> DictResult = new Dictionary<string, object>(); IList<Dictionary<string, string>> list = new List<Dictionary<string, st
不说废话,直接上代码.以下服务创建是在独立的WCF类库中,若采用WCF应程程序,定义及创建服务代码均相同,但文件名不同,是CalculatorService.svc 第一步,定义服务契约(Service Contract),即:定义一个服务接口 using System.ServiceModel; namespace WcfServiceLibrary1 { [ServiceContract(Namespace="http://www.zuowenjun.cn")] public in
SignalR是一个.NET Core/.NET Framework的实时通讯的框架,一般应用在ASP.NET上,当然也可以应用在Winform上实现服务端和客户端的消息通讯,本篇随笔主要基于SignalR的构建一个基于Winform的服务端和客户端的通讯处理案例,介绍其中的处理过程. 1.SignalR基础知识 SignalR是一个.NET Core/.NET Framework的开源实时框架. SignalR的可使用Web Socket, Server Sent Events 和 Long
这篇来讲讲WebApi的自托管,WebApi可以托管到控制台/winform/服务上,并不是一定要依赖IIS才行. 1.首先新建控制台项目,在通过Nuget搜索Microsoft.AspNet.WebApi.SelfHost 2.建立实体类 public class Product { public int Id { set; get; } public string Name { set; get; } public string Description { set; get; } } 3.创