2013-08-01 2 views
1

Windows 서비스와 양식이 있으며 통신이 필요합니다. 내가 방문한 모든 사이트는 WCF를 가리 킵니다. 먼저 서비스에서 구현하려고했습니다. 이와 같이 :WCF가 Windows 서비스에서 끝점을 찾을 수 없습니다.

protected override void OnStart(string[] args) 
    { 
     event_log.WriteEntry("TOPIAM_ADM: start"); 
     timer.Start(); 
     ServiceReference1.Service1Client client = new ServiceReference1.Service1Client(); 
    } 

그게 WCF와 관련된 유일한 행입니다. 서비스를 시작하면이 오류가 표시됩니다.

서비스를 시작할 수 없습니다. System.InvalidOperationException : ServiceModel 클라이언트 구성 섹션에서 'ServiceReference1.IService1'계약을 참조하는 기본 끝점 요소를 찾을 수 없습니다. 이는 응용 프로그램에 대한 구성 파일이 없거나이 계약에 일치하는 엔드 포인트 요소가 클라이언트 요소에 없기 때. 일 수 있습니다. 시스템에서 System.ServiceModel.ChannelFactory.ApplyConfiguration (문자열 configurationName) 에서 System.ServiceModel.ChannelFactory.ApplyConfiguration (문자열 configurationName, 구성 설정) 에서 System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors (ServiceEndpoint에 ServiceEndpoint에, 문자열 configurationName) 에서 .ServiceModel.ChannelFactory.InitializeEndpoint 내가 시간 동안 고개를

System.ServiceModel.ChannelFactory 1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) at System.ServiceModel.ConfigurationEndpointTrait 1.CreateSimplexFactory() System.ServiceModel.Config에서 에서 (문자열 configurationName, EndpointAddress를 주소) ...하지만, 여전히 내가 어떻게해야하는지에 대한 단서가 없다. config 파일을 올바르게 설치하십시오.

WCF에는 자체 프로젝트가 있고 서비스에는 다른 서비스가 있으며 Windows 양식 앱에는 다른 프로젝트가 있습니다. 나는 그것이 설정 파일에서 왔다고 확신한다. 누구든지 나를 도울 수 있습니까?

서비스 프로젝트의 설정 : 내가 잘못 넣을 경우

>  <?xml version="1.0" encoding="utf-8" ?> <configuration> 
> <system.web> 
>  <compilation debug="true" /> </system.web> <!-- When deploying the service library project, the content of the config file must be 
> added to the host's app.config file. System.Configuration does not 
> support config files for libraries. --> <system.serviceModel> 
>  <bindings> 
>  <basicHttpBinding> 
>   <binding name="BasicHttpBinding_IService1" /> 
>  </basicHttpBinding> 
>  </bindings> 
>  <client> 
>  <endpoint address="http://localhost:8733/Design_Time_Addresses/TOPIAM_WCFLibrary/Service1/" 
>   binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" 
>   contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" /> 
>  </client> 
>  <behaviors> 
>  <serviceBehaviors> 
>   <behavior> 
>   <!-- To avoid disclosing metadata information, 
>   set the value below to false before deployment --> 
>   <serviceMetadata httpGetEnabled="True"/> 
>   <!-- To receive exception details in faults for debugging purposes, 
>   set the value below to true. Set to false before deployment 
>   to avoid disclosing exception information --> 
>   <serviceDebug includeExceptionDetailInFaults="False" /> 
>   </behavior> 
>  </serviceBehaviors> 
>  </behaviors> </system.serviceModel> 
> 
> </configuration> 

WCF 프로젝트의 설정

>  <?xml version="1.0" encoding="utf-8" ?> <configuration> 
> <system.web> 
>  <compilation debug="true" /> </system.web> <!-- When deploying the service library project, the content of the config file must be 
> added to the host's app.config file. System.Configuration does not 
> support config files for libraries. --> <system.serviceModel> 
>  <services> 
>  <service name="TOPIAM_WCFLibrary.Service1"> 
>   <host> 
>   <baseAddresses> 
>    <add baseAddress = "http://localhost:8733/Design_Time_Addresses/TOPIAM_WCFLibrary/Service1/" 
> /> 
>   </baseAddresses> 
>   </host> 
>   <!-- Service Endpoints --> 
>   <!-- Unless fully qualified, address is relative to base address supplied above --> 
>   <endpoint address="" binding="basicHttpBinding" contract="TOPIAM_WCFLibrary.IService1"> 
>   <!-- 
>    Upon deployment, the following identity element should be removed or replaced to reflect the 
>    identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
>    automatically. 
>   --> 
>   <identity> 
>    <dns value="localhost"/> 
>   </identity> 
>   </endpoint> 
>   <!-- Metadata Endpoints --> 
>   <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
>   <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> 
>   <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
>  </service> 
>  </services> 
>  <behaviors> 
>  <serviceBehaviors> 
>   <behavior> 
>   <!-- To avoid disclosing metadata information, 
>   set the value below to false before deployment --> 
>   <serviceMetadata httpGetEnabled="True"/> 
>   <!-- To receive exception details in faults for debugging purposes, 
>   set the value below to true. Set to false before deployment 
>   to avoid disclosing exception information --> 
>   <serviceDebug includeExceptionDetailInFaults="False" /> 
>   </behavior> 
>  </serviceBehaviors> 
>  </behaviors> </system.serviceModel> 
> 
> </configuration> 

누구나 지적 할 수 있습니까?

답변

0

시작 설정 WinForms 응용 프로그램 프로젝트에 서비스 설정이 포함 된 구성 파일을 저장해야합니다.