赵亚波,唐纳·卡兰,plu 丝丝
using System; using System.ServiceModel; using System.ServiceModel.Channels; //注意:需要引用程序集 System.ServiceModel 并在管理员模式下运行 class Program { static void Main(string[] args) { Uri httpAddress = new Uri("http://localhost:8002"); ServiceHost serviceHost = new ServiceHost(typeof(Service1), httpAddress); Binding binding = new WSHttpBinding(); serviceHost.AddServiceEndpoint(typeof(IService1), binding, "http://localhost:8002/a"); serviceHost.AddServiceEndpoint(typeof(IService1), binding, "http://localhost:8002/b"); serviceHost.Open(); Console.ReadLine(); serviceHost.Close(); } } [ServiceContract] public interface IService1 { [OperationContract] void DoWork(); } [ServiceContract] public interface IService2 { [OperationContract] void Do(); } public class Service1 : IService1, IService2 { public void Do() { } public void DoWork() { } }
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Net Core Web Api项目与在NginX下发布的方法
asp.net core3.1 引用的元包dll版本兼容性问题解决方案
IdentityServer4实现.Net Core API接口权限认证(快速入门)
ASP.NET Core MVC通过IViewLocationExpander扩展视图搜索路径的实现
网友评论