我试图建立硬的手法服务(不作任何估计)。
service = new CommService.TwService();
localHost = new ServiceHost(service);
ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
localHost.Description.Behaviors.Add(behavior);
localHost.AddServiceEndpoint(typeof(IMetadataExchange),
MetadataExchangeBindings.CreateMexNamedPipeBinding(),
"net.pipe://localhost/service/mex/");
localHost.Open();
fails with :
Service CommService.TwService has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.