C# 如何通过ServiceBehavior配置启用WCF帮助页?

C# 如何通过ServiceBehavior配置启用WCF帮助页?,c#,wcf,web-services,servicebehavior,C#,Wcf,Web Services,Servicebehavior,我希望为配置了而不是的WCF服务启用生成的帮助页。我95%的搜索结果与有关,而我在中找到的少数搜索结果要么没有答案,要么缺乏细节,要么根本不起作用 我不是这个托管在IIS上的服务的创建者,但负责启用该服务的帮助页面。根据我的发现,我应该能够在ServiceDebug元素下启用httpHelpPageEnabled属性,但这不起任何作用,添加httpHelpPageUrl在浏览器中查看时会中断整个服务 配置:相关部分 <system.serviceModel> <serv

我希望为配置了
而不是
的WCF服务启用生成的帮助页。我95%的搜索结果与
有关,而我在
中找到的少数搜索结果要么没有答案,要么缺乏细节,要么根本不起作用

我不是这个托管在IIS上的服务的创建者,但负责启用该服务的帮助页面。根据我的发现,我应该能够在ServiceDebug元素下启用
httpHelpPageEnabled
属性,但这不起任何作用,添加
httpHelpPageUrl
在浏览器中查看时会中断整个服务

配置:相关部分

<system.serviceModel>  
  <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
  <bindings>
    <basicHttpBinding>
      <binding name="serviceBinding">
        <security mode="None">
        </security>
      </binding>
    </basicHttpBinding>
    <wsHttpBinding>
      <binding name="serviceWsBinding">
        <security mode="None">
        </security>
      </binding>
    </wsHttpBinding>
  </bindings>
  <client />
  <services>
    <service behaviorConfiguration="ServiceBehavior" name="ServicesLib.Service">
      <endpoint listenUri="soap" name="soap" address="http://servicesdev.mySite.com/services/Service.svc/soap" binding="basicHttpBinding" bindingConfiguration="serviceBinding" contract="ServicesLib.IService" />
      <endpoint listenUri="soap12" name="soap12" address="http://servicesdev.mySite.com/services/Service.svc/soap12" binding="wsHttpBinding" bindingConfiguration="serviceWsBinding" contract="ServicesLib.IService" />
      <host>
        <baseAddresses>
          <add baseAddress="http://servicesdev.mySite.com/services" />
        </baseAddresses>
      </host>
    </service>
  </services>
  <behaviors>
    <!-- These EndpointBehaviors aren't used, they are just here :? -->
    <endpointBehaviors>
      <behavior name="restBehavior">
        <webHttp />
      </behavior>
      <behavior name="soapBehavior">
        <webHttp helpEnabled="true" />
      </behavior>
    </endpointBehaviors>
    <serviceBehaviors>
      <behavior name="ServiceBehavior">
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" externalMetadataLocation="../Services.wsdl" />
        <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

关于从windows服务托管一个服务的解决方案,但我不确定如何将其添加到将以相同方式与服务一起托管的WCF服务


<endpoint listenUri="soap" name="soap" address="http://servicesdev.mySite.com/services/Service.svc/soap" binding="basicHttpBinding" bindingConfiguration="serviceBinding" contract="ServicesLib.IService" behaviorConfiguration="restBehavior" />
      <endpoint listenUri="soap12" name="soap12" address="http://servicesdev.mySite.com/services/Service.svc/soap12" binding="wsHttpBinding" bindingConfiguration="serbviceWsBinding" contract="ServicesLib.IService" behaviorConfiguration="soapBehavior" />

    <endpointBehaviors>  
          <behavior name="restBehavior">
            <webHttp helpEnabled="true"/>
          </behavior>
          <behavior name="soapBehavior">
            <webHttp helpEnabled="true" />
          </behavior>
    </endpointBehaviors>

ServiceDebugElement
HttpHelpPageEnabled
HttpHelpPageUrl
属性提供了一种启用自定义帮助页面的机制。但是,属性不会自动告诉服务器生成自定义页面。为了提供您自己的自定义帮助内容,您需要为静态html帮助页面或返回自定义帮助页面的端点提供URL(如您引用的文章所述)。

关于,

两个端点都是Soap,尝试发布的代码会导致另一个错误。“”处的终结点不具有None MessageVersion的绑定。“.WebHttpBehavior”仅用于WebHttpBinding或类似绑定。搜索此项时,似乎SOAP终结点根本不能具有“webHttp”行为,所以EndpointBehavior将不起作用。明天我将进一步研究这条路径,因为我认为我可能必须沿着这条路线走。在做了进一步的研究之后,我们决定现在使用静态html页面。谢谢你对此的澄清。