我在example on MSDN中添加了帮助页面端点,我的元数据交换端点停止工作。我尝试查看元数据时的异常详细信息http://imgur.com/delete/HYe9c9OocABgxOj如果没有它,一切都很好,但我需要附上帮助页面
<system.serviceModel>
<services>
<service behaviorConfiguration="MyServiceBehaviors" name="GoalTracker.WcfRestService.Service1">
<endpoint address="mex" binding="mexHttpBinding" contract="GoalTracker.WcfRestService.IService1" />
<endpoint address="" binding="webHttpBinding" contract="GoalTracker.WcfRestService.IService1" />
<endpoint address="Help" kind="webHttpEndpoint"
behaviorConfiguration="RESTEndpointBehavior"
contract="GoalTracker.WcfRestService.IService1" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehaviors">
<!-- Add the following element to your service behavior configuration. -->
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="True"
httpHelpPageEnabled="True"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="RESTEndpointBehavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
答案 0 :(得分:1)
mex
端点上的合同应为IMetadataExchange
但是,我不确定为什么您需要mex
端点,因为您的服务是基于REST的。
通过在端点行为中设置helpEnabled="true"
,将自动启用帮助页面。您无需添加具有"Help"
地址的其他端点。请删除该端点。
在主要终端kind="webHttpEndpoint"
上设置behaviorConfiguration="RESTEndpointBehavior"
和address=""
。
所以看起来应该是这样的:
<service behaviorConfiguration="MyServiceBehaviors" name="GoalTracker.WcfRestService.Service1">
<endpoint address="" kind="webHttpEndpoint"
behaviorConfiguration="RESTEndpointBehavior"
contract="GoalTracker.WcfRestService.IService1" />
</service>