搜惠兔,不打不相亲,伍娇微博
using System; using System.Diagnostics; using System.Linq; using System.ServiceModel; using System.ServiceModel.Channels; using System.ServiceModel.Description; class Program { static void Main(string[] args) { ServiceHost serviceHost = new ServiceHost(typeof(Service1),new Uri("http://localhost:8000/EssentialWCF"));
//ServiceHost serviceHost = new ServiceHost(typeof(Service1)); ServiceMetadataBehavior behavior = serviceHost.Description.Behaviors.Find<ServiceMetadataBehavior>(); if (behavior==null) { behavior = new ServiceMetadataBehavior(); behavior.HttpGetEnabled = true;
//behavior.HttpGetUrl=new Uri("http://localhost:8000/EssentialWCF"); serviceHost.Description.Behaviors.Add(behavior);
//serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "http://localhost:8002/Essential"); } serviceHost.Open(); Console.ReadLine(); } [ServiceContract] public interface IService1 { [OperationContract] void DoWork(); } [ServiceContract] public interface IService2 { [OperationContract] void Do(); } public class Service1 : IService1, IService2 { public static void Configure(ServiceConfiguration config) { Uri httpAddress = new Uri("http://localhost:8002"); Binding binding = new WSHttpBinding(); config.AddServiceEndpoint(typeof(IService1), binding, "http://localhost:8003/a"); config.AddServiceEndpoint(typeof(IService2), binding, "http://localhost:8003/b"); } public void Do() { } public void DoWork() { } } }
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论