1
我有一个托管在托管Windows服务中的WCF服务,该服务是根据this手册开发的。在App.config中我指定了以下内容:托管在托管Windows服务中的WCF服务无法从另一台计算机访问
<service name="Inpas.Unipos.LicenseManager.SamService.Service"
behaviorConfiguration="SamServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/SamService/service"/>
</baseAddresses>
</host>
<endpoint address=""
binding="wsHttpBinding"
contract="Inpas.Unipos.LicenseManager.SamService.IService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
在客户我连接到这种方式服务:
public void ConnectToService(string host, string port)
{
var binding = new WSHttpBinding();
var endpoint = new EndpointAddress(string.Format("http://{0}:{1}/SamService/service", host, port));
var channelFactory = new ChannelFactory<IService>(binding, endpoint);
_client = channelFactory.CreateChannel();
_client.Get2X2();
}
在本地机器上它工作正常,但如果我尝试连接到从服务另一台机器 - 我得到一个异常:
EndpointNotFoundException 消息:有没有终点在http://10.xx.xx.xx:8000/SamService/service是可以接受的消息听。这通常是由不正确的地址或SOAP操作引起的。
我在做什么错?
您是否能够从另一个盒子中看到服务IE? – Dhawalk 2013-04-10 16:05:51
@Dhawalk什么是盒子?如何检查? – Zharro 2013-04-10 16:35:22
您是否在其他机器上使用'http:// localhost:8000/SamService/service'作为**服务**的地址?如果是这样,您需要将地址更改为机器名称(或域名)(例如http://www.mydomain.com/“ - localhost仅指运行程序的计算机。 – Tim 2013-04-10 17:57:51