我希望为使用<ServiceBehavior>而不是<EndpointBehavior>配置的WCF服务启用生成的帮助页。95%的搜索结果与<EndpointBehavior>有关,而我为<ServiceBehavior>找到的东西要么没有答案,要么缺乏细节,或者根本不起作用。
我不是此服务的创建者,该服务托管在IIS上,但任务是为该服务启用帮助页。根据我所发现的,我应该能够在ServiceDebug元素下启用ServiceDebug属性,但是这没有任何作用,在浏览器中查看时添加httpHelpPageUrl会破坏整个服务。
Config:相关部分。
<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服务中,该服务将以同样的方式与该服务一起托管。
发布于 2014-01-28 22:21:29
ServiceDebugElement HttpHelpPageEnabled和HttpHelpPageUrl属性提供了启用自定义帮助页的机制。但是,这些属性不会自动告诉服务器生成自定义页。为了提供您自己的自定义帮助内容,您需要为静态html帮助页或返回自定义帮助页的端点提供URL (如您所引用的文章中所讨论的)。
致以敬意,
发布于 2014-01-28 22:20:51
<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>https://stackoverflow.com/questions/21417110
复制相似问题