仅针对某些端点禁用 WCF 帮助页面

发布于 2024-12-24 21:30:02 字数 1353 浏览 5 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文