ServiceDebugBehavior.HttpHelpPageEnabled 属性      
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值控制 Windows Communication Foundation (WCF) 是否在由 HttpHelpPageUrl 属性控制的地址发布 HTML 帮助页。
public:
 property bool HttpHelpPageEnabled { bool get(); void set(bool value); };public bool HttpHelpPageEnabled { get; set; }member this.HttpHelpPageEnabled : bool with get, setPublic Property HttpHelpPageEnabled As Boolean属性值
如果 WCF 发布 HTML 帮助页,则为 true;否则为 false。 默认值为 true。
示例
下面的代码示例演示如何使用配置文件来启用 HTML 帮助页功能,并将 SOAP 错误内部的异常信息返回给客户端以供调试。 此配置文件演示以下用于添加对 ServiceDebugBehavior 功能的支持的基本步骤:
- 由于类型 ServiceDebugBehavior 是实现 System.ServiceModel.Description.IServiceBehavior , <因此表示服务类型的服务> 元素具有的行为配置标识符 - behaviorConfiguration="metadataAndDebug"。
- 同样,由于类型ServiceDebugBehavior是实现System.ServiceModel.Description.IServiceBehavior,因此<将行为>元素添加到 <serviceBehaviors> 节。 - name行为>元素的< 属性,其值是服务>元素的 属性的<标识符。- behaviorConfiguration在本例中,该值为- metadataAndDebug。
- 添加 serviceDebug<> 元素,并将各种属性设置为所需配置。 在本例中, - httpHelpPageEnabled和- includeExceptionDetailInFaults属性值设置为- true。
<configuration>
  <system.serviceModel>
    <services>
      <!-- 
        Step 1. Add a behaviorConfiguration attribute
        in the <service> element.
      -->
      <service 
        name="Microsoft.WCF.Documentation.SampleService"
        behaviorConfiguration="metadataAndDebug">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/SampleService" />
          </baseAddresses>
        </host>
        <endpoint
          address=""
          binding="wsHttpBinding"
          contract="Microsoft.WCF.Documentation.ISampleService"
        />
        <endpoint
           address="mex"
           binding="mexHttpBinding"
           contract="IMetadataExchange"
        />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <!-- 
          Step 2. Inside a <serviceBehaviors> section, add 
          a name attribute in the <behaviors> element that 
          matches the behaviorConfiguration attribute in the
          <service> element above.
        -->
        <behavior name="metadataAndDebug">
          <serviceMetadata 
            httpGetEnabled="true" 
            httpGetUrl=""
          />
          <!-- 
            Step 3. Add a <serviceDebug> element and 
            modify the various attributes that suit your 
            scenario.
          -->
          <serviceDebug 
            httpHelpPageEnabled="true" 
            includeExceptionDetailInFaults="true"
          />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
注解
将 HttpHelpPageEnabled 属性设置为 false,可禁止发布对 HTML 浏览器可见的 HTML 帮助页。
若要确保在由 HttpsHelpPageUrl 属性控制的位置发布 HTML 帮助页,您必须将此属性设置为 true,并且必须满足以下条件之一:
- HttpsHelpPageUrl 属性是支持 HTTP 协议方案的绝对地址。 
- 服务有支持 HTTP 协议方案的基址。 
尽管为 HttpsHelpPageUrl 属性指定不支持 HTTP 协议方案的绝对地址会引发异常,但不满足前面两个条件的任何其他方案都不会引发异常,也不会发布 HTML 帮助页。