[英]Self hosted wcf service, wsdl references to localhost
I have a web application that hosts a service. 我有一个托管服务的Web应用程序。 I start the service with: 我以以下内容启动服务:
Uri uri = new Uri(String.Format("http://localhost:{0}/", 12345));
_externalServiceHost = new ServiceHost(typeof(MyExternalService), uri);
When I run this and want to access the wsdl, it contains only links to localhost. 当我运行此程序并想访问wsdl时,它仅包含到localhost的链接。 But when I access the wsdl out of my machine the link is always over localhost. 但是,当我从机器上访问wsdl时,链接始终通过本地主机。 How can I configure it that it will always point to the right server? 如何配置它始终指向正确的服务器?
Ps: I am using Visual Studio 2008 with .Net 3.5 附:我正在使用Visual Studio 2008和.Net 3.5
In your web.config, there should be a block that looks something like this. 在您的web.config中,应该有一个看起来像这样的块。 Change the address attribute. 更改地址属性。
<service name="YOUR.SERVICE.TYPE"
behaviorConfiguration="YOUR.SERVICE.BEHAVIOR">
<endpoint name="basicHttpBinding"
address="http://your.domain.com/your/service/type"
binding="basicHttpBinding"
contract="YOUR.SERVICE.CONTRACT"/>
<endpoint name="mexHttpBinding"
contract="IMetadataExchange"
binding="mexHttpBinding"
address="mex" />
</service>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.