WCF 서비스를 호스팅하는 콘솔 응용 프로그램이 있습니다. 지금은 다음과 같은 방법으로 실행되도록 응용 프로그램을 구성 : 다음 WCF 콘솔 응용 프로그램 (여러 서비스 포함)
// within my program class
class Program
{
static void Main(string[] args)
{
// retrieve the current URL configuration
Uri baseAddress = new Uri(ConfigurationManager.AppSettings["Uri"]);
내가 이제 제외
using (WebServiceHost host = new WebServiceHost(typeof(MonitorService), baseAddress))
{
ServiceEndpoint endpoint = host.AddServiceEndpoint(typeof (IMonitorService), new WebHttpBinding(), "");
ServiceDebugBehavior stp = host.Description.Behaviors.Find<ServiceDebugBehavior>();
stp.HttpHelpPageEnabled = false;
host.Open();
Console.WriteLine("The service is ready at {0}", baseAddress);
Console.WriteLine("Press <Enter> to stop the service.");
Console.ReadLine();
// Close the ServiceHost.
host.Close();
}
지금까지 너무 좋아 내 WCF의 REST 서비스를 호스팅하는 WebServiceHost의 새로운 인스턴스를 시작 I 다음과 같은 구조에서 호스팅이 개 WCF 서비스를 가지고있는 요구 사항을 함께했다
http://localhost:[port]/MonitorService 및 http://localhost:[port]/ManagementService
새 서비스 엔드 포인트를 추가하고 다른 계약을 사용하여 두 엔드 포인트를 구별 할 수 있습니까? 그렇다면 두 계약의 구현은 WebServiceHost에서 사용하는 것과 같은 클래스 인 MonitorService에 있어야합니다.
그래서 사실은 내가, 서비스 당 하나씩 여러 서비스 호스트를 시작하고 콘솔 응용 프로그램이 종료 다운을 때 모두 함께 처리하는 메커니즘을 작성해야합니다. 감사 – Raffaeu