2016-10-06 5 views
0

WCF service을 사용하려고 할 때 아래 오류가 발생합니다. I looked into this issue and both name and contract values are same in both config files. WCF 서비스를 사용할 때 끝점 요소를 찾을 수 없습니다.

는 ServiceModel은 서비스 클라이언트 구성 섹션에서 'BasicHttpBinding_IService1' 계약 'ServiceReference1.IService1'이름을 가진 엔드 포인트 요소를 찾을 수 없습니다. 이는 응용 프로그램에 대해 구성 파일이 없거나 클라이언트 요소에 과 일치하는 끝점 요소가 없기 때문일 수 있습니다.

WCF 서비스가 내 솔루션에 자유 주의적이며 같은 솔루션으로 다른 클래스의 자유 프로젝트에서 사용하려고합니다.

Client.config

<endpoint address="http://localhost:8733/Design_Time_Addresses/WcfServiceLibrary1/Service1/" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" 
    contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" /> 
</client> 

WCF 설정 파일

<configuration> 

    <appSettings> 
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> 
    </appSettings> 
    <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="WcfServiceLibrary1.Service1"> 
     <host> 
      <baseAddresses> 
      <add baseAddress = "http://localhost:8733/Design_Time_Addresses/WcfServiceLibrary1/Service1/" /> 
      </baseAddresses> 
     </host> 
     <!-- Service Endpoints --> 
     <!-- Unless fully qualified, address is relative to base address supplied above --> 
     <endpoint address="" binding="basicHttpBinding" contract="WcfServiceLibrary1.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 values below to false before deployment --> 
      <serviceMetadata httpGetEnabled="True" httpsGetEnabled="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

서비스가 브라우저에서 사용 가능하다는 것을 아십니까? – silver

+0

브라우저에서 사용 가능합니다. – simbada

답변

1

당신은 귀하의 질문에 "You are trying to consume the service in a class library and calling the class library from another project."는 원래의 답변이 링크를 참조하십시오 말했다 나는이 문제를 생각합니다. link

문제를 해결하려면 방금 문제를 해결하십시오. d를 사용하여 클라이언트 바인딩 정보를 기본 호출자 프로젝트 구성 파일에 복사합니다.

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IService1" /> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost:8733/Design_Time_Addresses/WcfServiceLibrary1/Service1/" 
     binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" 
     contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" /> 
    </client> 
    </system.serviceModel> 
+0

이것이 문제를 해결할 수 있는지 보겠습니다. – simbada

+0

고마워, 그것은 나를 위해 일했다. – simbada

0

서비스 이름 및 계약서의 전체 네임 스페이스로 전체 이름 식별자를 사용해보십시오.

<service name="SOLUTIONNAME.WcfServiceLibrary1.Service1"> 
    <endpoint address="" binding="basicHttpBinding" 
    contract="SOLUTIONNAME.WcfServiceLibrary1.IService1"> 
    ... 

</service>