我目前正在开发一个使用WCF服务的项目,该服务托管在Windows服务中。我对这个概念相当陌生,因为我之前使用的是大多数WCF服务,我已经在IIS中托管了。
该服务正在使用netTcpBinding。
我遇到的问题是我无法将我的测试应用程序或WCFTestClient连接到该服务。
在我的测试应用程序中添加服务引用时,收到以下错误:
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8599/'.
Could not connect to net.tcp://localhost:8599/. The connection attempt lasted for a
time span of 00:00:02.0002000. TCP error code 10061: No connection could be made
because the target machine actively refused it 127.0.0.1:8599.
No connection could be made because the target machine actively refused it
127.0.0.1:8599
If the service is defined in the current solution, try building the solution and adding
the service reference again.
此时我输入的地址是:
net.tcp://localhost:8599/
我的配置如下:
<system.serviceModel>
<services>
<service name="ICAS.Service.Model.iMISDataService">
<endpoint contract="IMetadataExchange" name="iMISEvents-mexTcp" binding="mexTcpBinding" bindingConfiguration="" address="mex" />
<endpoint contract="ICAS.ServiceLibraries.ServiceContracts.IiMISEvents" name="iMISEvents-netTcp" binding="netTcpBinding" bindingConfiguration="ImisNetTcpBinding" address="">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8599/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="ImisNetTcpBinding" maxBufferPoolSize="1248576"
maxBufferSize="1248576" maxReceivedMessageSize="1248576">
<readerQuotas maxArrayLength="1248576" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
我还应该强调我已经关闭了Windows防火墙,并且我已经检查过Net.Tcp监听器适配器服务是否正在运行。
希望有人能指出我正确的方向。
提前致谢。
大卫。