在托管时发布的WCF服务的baseAddress是什么?

时间:2010-08-24 17:11:39

标签: wcf configuration web-hosting

我在我的应用程序上有服务,当我在localhost上测试时,everuthing就可以了。但是当我发布它时,我的基地址属性有问题。我该怎么办?

我的web.config部分:

<services>
  <service name="WcfService1.Service1" behaviorConfiguration="metadataBehavior">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="WcfService1BasicHttpBindingConfig"
      contract="WcfService1.IService1" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8731/WcfService1/MyService" />
      </baseAddresses>
    </host>
  </service>
  <service name="WcfService1.CrossDomainService">
    <endpoint address="" behaviorConfiguration="CrossDomainServiceBehavior"
      binding="webHttpBinding" contract="WcfService1.ICrossDomainService" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8731/" />
      </baseAddresses>
    </host>
  </service>
</services>

1 个答案:

答案 0 :(得分:2)

当前公开您的服务的主机的地址,例如:

<baseAddresses>
    <add baseAddress="http://www.myaddress.com/" />
</baseAddresses>

或者也许:

<baseAddresses>
    <add baseAddress="http://dev.myaddress.com/" />
</baseAddresses>

无论是什么。