无法将WCF服务指向主机名 [英] Unable to point WCF Service to HostName

查看:77
本文介绍了无法将WCF服务指向主机名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经为Silverlight应用程序托管了WCF服务,用于以下配置-

< pre lang ="HTML">< services>
< service behaviorConfiguration ="defaultServiceBehavior" name ="FauchierPartners.NewUnits.DataService.CrossDomainService">
<端点地址=" behaviorConfiguration ="webHttpBehavior" binding ="webHttpBinding" contract ="FauchierPartners.NewUnits.DataService.ICrossDomainService">
<!-< identity>
< dns value ="10.0.0.85"/>
</identity>->
</endpoint>
< host>
< baseAddresses>
< add baseAddress ="http://10.0.0.85:8735/"/>
</baseAddresses>
</host>
</service>
< service behaviorConfiguration ="defaultServiceBehavior" name ="FauchierPartners.NewUnits.DataService.NewUnitsDataService">
<!-<端点地址=" binding ="wsHttpBinding" contract ="FauchierPartners.NewUnits.DataService.INewUnitsDataService">->
<端点地址=" binding ="basicHttpBinding" bindingConfiguration ="winAuthBasicHttpBinding" contract ="FauchierPartners.NewUnits.DataService.INewUnitsDataService">
<!-< identity>
< dns value ="10.0.0.85"/>
</identity>->
</endpoint>
< endpoint address ="mex" binding ="mexHttpBinding" contract ="IMetadataExchange"/>
< host>
< baseAddresses>
< add baseAddress ="http://10.0.0.85:8735/NewUnitsDataService/"/>
</baseAddresses>
</host>
</service>
</services></pre>
同样,在我的Silverlight xap文件中配置IP地址和端口号,并在ServiceReferences.ClientConfig
中指定托管此服务的地址.
当前,如果可以看到,我们已经使用生产机器的IP地址进行了配置

但是,这需要更改,从而需要用DNS名称或仅将部署服务的主机的计算机名称替换IP地址.

我尝试这样做,但出现错误消息,无法解析主机名.

We have hosted a WCF service for a Silverlight Application for following configuration -

<pre lang="HTML"><services>
<service behaviorConfiguration="defaultServiceBehavior" name="FauchierPartners.NewUnits.DataService.CrossDomainService">
<endpoint address="" behaviorConfiguration="webHttpBehavior" binding="webHttpBinding" contract="FauchierPartners.NewUnits.DataService.ICrossDomainService">
<!--<identity>
<dns value="10.0.0.85"/>
</identity>-->
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://10.0.0.85:8735/"/>
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="defaultServiceBehavior" name="FauchierPartners.NewUnits.DataService.NewUnitsDataService">
<!--<endpoint address="" binding="wsHttpBinding" contract="FauchierPartners.NewUnits.DataService.INewUnitsDataService">-->
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="winAuthBasicHttpBinding" contract="FauchierPartners.NewUnits.DataService.INewUnitsDataService">
<!--<identity>
<dns value="10.0.0.85"/>
</identity>-->
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://10.0.0.85:8735/NewUnitsDataService/"/>
</baseAddresses>
</host>
</service>
</services></pre>
And same, IP address and port number is configured in my Silverlight xap file, specifying the address where this service is hosted, in ServiceReferences.ClientConfig

Currently, if you can see we have configured using the IP Address of the Production Machine

However, this needs to be changed, whereby IP Address needs to be replaced by the DNS name or simply the Machine Name of the host where service is deployed.

I tried doing so, but I got an error saying, unable to resolve host name.

Can someone you please throw light on this, as to what would be the possible solution?

推荐答案

您可以在C:\的主机文件中添加主机名. WINDOWS \ system32 \ drivers \ etc
You can add your host name in the host file located in C:\WINDOWS\system32\drivers\etc


这篇关于无法将WCF服务指向主机名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆