2011-08-19 10 views
1

클라이언트 컴퓨터에서 WCF 서비스에 액세스 할 수 없습니다클라이언트 컴퓨터에서 WCF 서비스에 액세스 할 수 없습니다

  • 나는 세 가지 프로젝트가 : WCF 서비스 (VS-2008), Windows 서비스 (VS-2008), 클라이언트 (VS-를 2005)
  • WCF 서비스가 netTcpBinding을 가지고
  • 이 서비스는 Windows 서비스로 호스팅 및하지의 서비스 (WCF 및 Windows) 모두

기본 주소를 IIS되어

입니다 내가 VS-2005에있는 클라이언트 프로젝트에 서비스 참조를 추가 할 때 6,
net.tcp://localhost:8010/WCFService.Service1/ 

지금, 그것은 내 app.config 파일

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 
     <bindings> 
      <netTcpBinding> 
       <binding name="netTcpEndPoint" closeTimeout="00:01:00" openTimeout="00:01:00" 
        receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" 
        transferMode="Buffered" transactionProtocol="OleTransactions" 
        hostNameComparisonMode="StrongWildcard" listenBacklog="10" 
        maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" 
        maxReceivedMessageSize="65536"> 
        <readerQuotas maxDepth="32" maxStringContentLength="8192"   maxArrayLength="16384" 
         maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
        <reliableSession ordered="true" inactivityTimeout="00:10:00" 
         enabled="false" /> 
        <security mode="Transport"> 
        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" /> 
         <message clientCredentialType="Windows" /> 
        </security> 
       </binding> 
      </netTcpBinding> 
     </bindings> 
     <client> 
      <endpoint address="net.tcp://localhost:8010/WCFService.Service1/" 
       binding="netTcpBinding" bindingConfiguration="netTcpEndPoint" 
       contract="Client.Service1.IService1" 
       name="netTcpEndPoint"> 
       <identity> 
        <servicePrincipalName value="host/server17.domain.com" /> 
       </identity> 
      </endpoint> 
     </client> 
    </system.serviceModel> 
</configuration> 

를 업데이트하고

<?xml version="1.0" encoding="utf-8"?> 
<ServiceReference> 
    <ProxyGenerationParameters 
     ServiceReferenceUri="net.tcp://server17:8010/WCFService.Service1/" 
     Name="Service1" 
     NotifyPropertyChange="False" 
     UseObservableCollection="False"> 
    </ProxyGenerationParameters> 
    <EndPoints> 
     <EndPoint 
      Address="net.tcp://localhost:8010/WCFService.Service1/" 
      BindingConfiguration="netTcpEndPoint" 
      Contract="Client.Service1.IService1" 
      > 
     </EndPoint> 
    </EndPoints> 
</ServiceReference> 
로 Service1.map 파일을 추가합니다 나는 서비스 방법 중 하나를 호출 할 때

나는

수 없습니다 사기꾼을 알리는 오류 net.tcp : // localhost : 8010/WCFService.Service1 /에 연결하십시오. 연결 시도가 00 : 00 : 02.0063936의 기간 동안 지속되었습니다. TCP 오류 코드 10061 : 대상이 기계가 적극적으로 거부 한 127.0.0.1:8010이므로 연결할 수 없습니다.

은 적어도 내가 이미 클라이언트 프로젝트에 server17localhost를 교체 시도하지 않은 ...하지만이 작동하려면 더 행운

내가 변경해야 net.tcp://server17:8010/WCFService.Service1/

해야 하는가? 도와주세요.

는 Windows 서비스의 의 app.config과 동일하다 내 WCF 서비스의의 App.config입니다 : 추측에서 팀

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.web> 
    <compilation debug="true" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service behaviorConfiguration="WCFService.ServiceBehavior" 
     name="WCFService.Service1"> 
     <endpoint address="" binding="netTcpBinding" bindingConfiguration="" 
      name="netTcpEndPoint" contract="WCFService.IService1" /> 
     <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" 
      name="mexTcpEndPoint" contract="IMetadataExchange" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="net.tcp://localhost:8010/WCFService.Service1/" /> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="WCFService.ServiceBehavior"> 
      <serviceMetadata httpGetEnabled="False" /> 
      <serviceDebug includeExceptionDetailInFaults="False" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
</configuration> 
+0

서비스와 클라이언트가 동일한 시스템에서 실행되고 있습니까? 이것은 네트워크 관련 오류입니다. 서비스가 실행 중이 아니거나 포트 8010을 바인드하지 않았을 것입니다. 명령 프롬프트를 열고 서비스가 실행중인 컴퓨터에서 "telnet localhost 8010"을 사용하여 연결을 시도하십시오. 연결이되지 않으면 서비스가 포트 8010에서 수신 대기가되지 않습니다. – Jan

답변

1

의 요청에 따라 내가 세 가지를 확인할 것 :

  1. 클라이언트에 서비스 참조를 추가 할 때 net.tcp://localhost:8010/WCFService.Service1/에서 추가 하시겠습니까? 아니면 net.tcp://server17:8010/WCFService.Service1/에서 추가 하시겠습니까?

  2. server17에서 추가하는 경우 서버의 정규화 된 이름 (예 : server17.mydomain.com)을 사용하십시오.

  3. 연결 오류는 사용중인 끝점 주소와 관련이 있습니다. 클라이언트가 "host/server17.domain.com"의 serverPrincipalName을 전달하지만 localhost에 연결하려고합니다.

위의 원인 중 어떤 것도 보장 할 수는 없지만 시작할 장소가 있습니다.

편집

당신은 기본 주소 요소의 locahost를 지정,하지만 당신은 endpiont 요소의 주소 속성에 아무것도 지정하지 마십시오. 이것이 아마 localhost로가는 이유 일 것입니다.

는 당신의 서비스에 대한 설정 파일을 수정 중 하나에 기본 주소를 변경 :

<baseAddresses> 
    <add baseAddress="net.tcp://server17:8010/WCFService.Service1/" /> 
</baseAddresses> 

또는 baseAddresses을 삭제하고 엔드 포인트에 주소를 지정합니다

<endpoint address="net.tcp://server17:8010/WCFService.Service1/" 
      binding="netTcpBinding" 
      bindingConfiguration="" 
      name="netTcpEndPoint" 
      contract="WCFService.IService1" /> 

는 시도한다는주십시오.

+0

안녕하세요, 답장을 보내 주셔서 감사합니다. net.tcp : // server17 : 8010/WCFService.Service1/URI 을 사용하여 참조를 추가했으며 제안한대로 정규화 된 이름을 사용했지만 여전히 작동하지 않으며 같은 오류가 나타납니다. server17 대신 localhost에 접속하려는 이유가 궁금합니다. 그리고 Server17에서 서비스 참조를 추가 한 후에도 localhost가있는 URI가있는 이유는 무엇입니까? (위의 주어진 config 및 map 파일에서 볼 수 있듯이). WCF 서비스의 baseaddress와 관련이 있습니까? localhost를 가리키는 app.config? – Bravo

+0

@ 브라보 - 관련성이있을 수 있습니다. 나는 당신이 완전한 주소를 명시 적으로 설정하고 있기 때문에 그것이 될 것이라고 (내 머리 꼭대기에서) 생각하지 않을 것입니다. 그것을 제거하고 트릭을하는지보십시오. 또한 서비스의 app.config 파일을 게시하십시오. – Tim

+0

ok Tim, 내 서비스 구성 파일을 게시했습니다. 질문 문을보십시오. – Bravo

관련 문제