仅针对某些端点禁用 WCF 帮助页面
我有一个 WCF REST 服务,并使用 web.config 文件启用了帮助页面
这非常适合以下端点(所有端点都根据不同的计算返回相似类型的数据)
mysite.com/GetData/{id}
mysite.com/GetData/v2/{id}
mysite.com/GetData/v3/{id}
mysite.com/GetData/v4/{id}
我还不想向我的客户公开 v3 和 v4 帮助页面,因此我尝试禁用 v3 和 v4 的帮助。使用此链接中的说明 http://blogs.msdn.com/b/endpoint/archive/2010/02/01/returning-custom-formats-from-wcf-webhttp-services.aspx 如下:
<服务名称=“Services.MyService”>
<端点地址=“/v3”kind=“webHttpEndpoint” 契约=“Services.MyService”端点配置=“EndPointv3”>
<端点地址=“/v4”kind=“webHttpEndpoint” 契约=“Services.MyService”端点配置=“EndPointv4”>
和
这对我不起作用,并且所有端点都会显示帮助页面。但是,如果我将端点地址留空 (address=""),则所有端点的帮助页面都将禁用。关于如何仅禁用 v3 和 v4 的帮助页面有什么想法吗?
I have a WCF REST Service with the help page enabled using the web.config file
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
This works perfectly for the following endpoints (all return similar type of data based on different calculations)
mysite.com/GetData/{id}
mysite.com/GetData/v2/{id}
mysite.com/GetData/v3/{id}
mysite.com/GetData/v4/{id}
I don't want to expose v3 and v4 help pages to my clients yet and so I tried to disable the help for v3 and v4. Using the instructions in this link http://blogs.msdn.com/b/endpoint/archive/2010/02/01/returning-custom-formats-from-wcf-webhttp-services.aspx as follows:
<service name="Services.MyService">
<endpoint address="/v3" kind="webHttpEndpoint"
contract="Services.MyService" endpointConfiguration="EndPointv3"></endpoint>
<endpoint address="/v4" kind="webHttpEndpoint"
contract="Services.MyService" endpointConfiguration="EndPointv4"></endpoint>
</service>
and
<standardEndpoint name="EndPointv3"/>
<standardEndpoint name="EndPointv4"/>
This will not work for me and the help pages appear for all endpoints. However, if I leave the endpoint address empty (address=""), help pages are disabled for all endpoints. Any ideas on how I can disable the help pages for v3 and v4 only?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论