클라이언트 컴퓨터에서 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이므로 연결할 수 없습니다.
server17
와
localhost
를 교체 시도하지 않은 ...하지만이 작동하려면 더 행운
내가 변경해야 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>
서비스와 클라이언트가 동일한 시스템에서 실행되고 있습니까? 이것은 네트워크 관련 오류입니다. 서비스가 실행 중이 아니거나 포트 8010을 바인드하지 않았을 것입니다. 명령 프롬프트를 열고 서비스가 실행중인 컴퓨터에서 "telnet localhost 8010"을 사용하여 연결을 시도하십시오. 연결이되지 않으면 서비스가 포트 8010에서 수신 대기가되지 않습니다. – Jan