[英]How to enable WCF help pages through ServiceBehavior configuration?
I am looking to enable generated Help Pages for a WCF service that is configured with a <ServiceBehavior>
instead of a <EndpointBehavior>
. 我希望为配置了
<ServiceBehavior>
而不是<EndpointBehavior>
的WCF服务启用生成的帮助页面。 95% of my searches result in something to do with <EndpointBehavior>
and what few I do find for the <ServiceBehavior>
are either unanswered, lack detail, or simply do not seem to work. 我有95%的搜索结果与
<EndpointBehavior>
而我对<ServiceBehavior>
发现却很少,或者没有答案,或者缺乏详细信息,或者根本看起来不起作用。
I'm not the creator of this service which is hosted on IIS, but was tasked with enabling the Help Pages for the service. 我不是该服务的创建者,该服务托管在IIS上,但它的任务是启用该服务的帮助页面。 From what I have found, I should simply be able to enable the
httpHelpPageEnabled
attribute under the ServiceDebug element, but this does nothing and adding httpHelpPageUrl
breaks the entire service when viewing in a browser. 从我发现的结果来看,我应该只能够启用ServiceDebug元素下的
httpHelpPageEnabled
属性,但这不会执行任何操作,并且添加httpHelpPageUrl
会在浏览器中查看时破坏整个服务。
Config: relevant section anyway. 配置:相关部分。
<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>
If this is not the right approach for whatever reason, perhaps someone could point me in the right direction of hosting custom Help Pages? 如果由于某种原因这不是正确的方法,也许有人可以指出我托管自定义帮助页面的正确方向? I have been reading this post on a solution for hosting one from a windows service but I am unsure of how to add this to a WCF Service that will be hosted alongside the service in the same manner.
我一直在阅读有关从Windows服务托管一个服务的解决方案的文章 ,但不确定如何将其添加到将与服务一起托管的WCF服务中。
The ServiceDebugElement HttpHelpPageEnabled
and HttpHelpPageUrl
properties provide a mechanism to enable a custom help page. ServiceDebugElement的
HttpHelpPageEnabled
和HttpHelpPageUrl
属性提供了一种启用自定义帮助页面的机制。 The properties will not, however, automatically tell the server to generate a custom page. 但是,这些属性不会自动告诉服务器生成自定义页面。 In order to provide your own custom help content, you will need to provide a URL for either a static html help page or an endpoint that returns the custom help page (as discussed in the article you referenced).
为了提供自己的自定义帮助内容,您将需要为静态html帮助页面或返回自定义帮助页面的端点提供URL(如您所引用的文章中所述)。
Regards, 问候,
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.