2010-04-23 2 views
1

다섯 가지 서비스 계약이 포함 된 WCF 서비스 라이브러리가 있습니다. 라이브러리는 Windows 서비스를 통해 호스팅됩니다. 대부분 WCF 라이브러리에 대한 모든 구성이 선언적입니다. 내가 구성을 위해 코드에서 수행하는 유일한 작업은 ServiceHost에 서비스 계약을 구현하는 클래스 유형을 전달하는 것이다. 그런 다음 Windows 서비스 OnStart 이벤트 동안 각 서비스에서 열기를 호출합니다. 다음은 오류 메시지입니다.Windows 서비스를 통해 WCF 서비스 Lib 호스팅 System.InvalidOperationException : WCF 서비스를 시작하려고 시도

서비스를 시작할 수 없습니다. System.InvalidOperationException : 서비스 '[Fubu.Conversion.Service1'에 응용 프로그램 (비 인프라) 끝 점이 없습니다. 이것은 응용 프로그램에 대한 구성 파일이 없거나 서비스 이름과 일치하는 서비스 요소가 구성 파일에서 발견되지 않았거나 서비스 요소에 엔드 포인트가 정의되지 않았기 때. 일 수 있습니다. System.ServiceModel.Description.DispatcherBuilder.EnsureThereAreNonMexEndpoints에서 는 system.serviceModel에서 System.ServiceModel.ServiceHostBase.InitializeRuntime()에서 System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost (ServiceDescription에 설명, ServiceHost를 ServiceHostBase)에서 (ServiceDescription에 설명) 후부에 System.ServiceModel.Channels.CommunicationObject.Open()에서 System.ServiceModel.Channels.CommunicationObject.Open (타임 아웃 시간 범위)에서 System.ServiceModel.ServiceHostBase.OnOpen (타임 아웃 시간 범위)에서 .ServiceHostBase.OnBeginOpen() .RemotingHost.RemotingHost.StartServ ...

위의 각은 단순히 다음을 수행하십시오

private void StartSecurityService() 
    { 
     host = new ServiceHost(typeof(Service1)); 
     host.Open(); 
    } 

서비스 해방 app.congfig 요약하면

<services> 
    <service behaviorConfiguration="DefaultServiceBehavior" name="Fubu.Conversion.Service1"> 
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="TCPBindingConfig" 
     name="Service1" bindingName="TCPEndPoint" contract="Fubu.Conversion.IService1"> 
     <identity> 
     <dns value="localhost" /> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" 
     name="mexSecurity" bindingName="TcpMetaData" contract="IMetadataExchange" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="net.tcp://localhost:8025/Fubu/Conversion/Service1/" /> 
     </baseAddresses> 
    </host> 
    </service> 

은 ...

계약이 설정됩니다 최대로 다음 : 네임 스페이스 Fubu.Conversion.Service1 {

[ServiceContract(Namespace = "net.tcp://localhost:8025/Fubu")] 
public interface IService1 
{ 

내가 운이없는 솔루션 "높고 낮은"보았다. 대답은 분명합니까? 이것에 대한 해결책은없는 것 같습니다. 감사합니다

답변

1

그리고 이유는 고통스럽게 간단합니다 !! 질문에서 설명한대로 WCF 서비스 라이브러리가 Windows 서비스 내에서 호스팅됩니다. WCF Service Library 프로젝트에서 app.config 파일을 잘못 정의하고 찾았습니다. app.config 파일이 항상 빌드의 bin 폴더로 출력되도록했습니다. 이 구성 파일을 Windows 서비스 프로젝트로 옮기거나 복사하면 문제가 해결되고 서비스 중 5 개가 올바르게 시작되었습니다. 주목해야 할 점 중 하나는 개별 서비스에 대해 정의 된 끝점이 고유 한 포트를 사용하는지 확인하는 것입니다.

그리고 이야기의 도덕적

: "사용자가 정의해야합니다 및 서비스 라이브러리를 호스팅 할 프로젝트 내에서 의 app.config 파일을 찾습니다

.
관련 문제