配置WCF主机服务

时间:2012-02-14 17:58:14

标签: c# wcf web-services host

我有一个关于Host app.config文件配置的基本问题

假设我在PC上托管我的WCF服务,其IP为:123.456.789.001:999

这是我的app.config文件:

<configuration>

<services>
  <service name="Service.WebexClient" behaviorConfiguration="MyServiceTypeBehaviors"   >
    <host>
      <baseAddresses>
        <add baseAddress="http://<What should I put here>:9999/MyWebexService"/>
      </baseAddresses>
    </host>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MyServiceTypeBehaviors" >
     <serviceDebug includeExceptionDetailInFaults="true"/> 
<serviceMetadata httpGetEnabled="true"  httpGetUrl="http://<And What should I put here>:9999/MyWebexService/Help"/>

</behavior>
  </serviceBehaviors>
</behaviors>

 

我想知道我应该在baseAddress和httpGetUrl中插入哪些正确的参数。我很迷惑。我应该放“localhost”还是ip(123.456.789.001)?

1 个答案:

答案 0 :(得分:2)

我相信你会使用端点的IP地址和httpGetUrl的WSDL:

<baseAddresses>         
  <add baseAddress="http://123.456.789.001:9999/MyWebexService"/>
</baseAddresses> 

<behavior name="MyServiceTypeBehaviors" >         
  <serviceDebug includeExceptionDetailInFaults="true"/>     
  <serviceMetadata httpGetEnabled="true" httpGetUrl="http://123.456.789.001:9999/MyWebexService?wsdl"/>        
</behavior>