配置WCF主机服务

本文关键字:主机服务 WCF 配置 | 更新日期: 2023-09-27 18:24:49

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

假设我在pc上托管WCF服务,其IP为:123.456.789.001:9999

这是我的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)?

配置WCF主机服务

我相信您应该使用端点的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>