WCF 端点的自定义描述页面?
我正在将 ASP.NET Web 服务迁移到 WCF。 旧的 Web 服务端点有一个很好的、广泛的描述页面,该页面是根据作为服务端点公开的底层类的注释生成的。特别是,列出了所有可用的网络方法。
有没有办法用 WCF 模拟这种行为?至少,我如何自定义 WCF 端点的 HTML 内容?
I am migrating an ASP.NET Web Service toward WCF. The old Web Service endpoint had a nice extensive description page generated from the comment of the underlying class exposed as a service endpoint. In particular, all available web methods were listed.
Is there a way to emulate somehow this behavior with WCF? At least, how can I customize the HTML content of the WCF endpoint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,不,现在没有办法改变这一点。
据我所听到和读到的,WCF 4 中将有一个可定制的“帮助页面”机制 - 但据我所知,仅适用于基于 REST 的服务(没有 WSDL/XSD 的帮助) 。
看看这个:WCF Web编程帮助页面
对于基于 SOAP 的服务:您始终可以定义自己的自定义 URL,在其中放置应由客户端检索的 WSDL/XSD,但仅此而已 - 描述您的服务的 WSDL。您当然可以在文档中添加 WSDL 注释来进行一些解释,但这仍然相当有限。
我认为 WCF 中没有任何“开箱即用”的规定来支持操作/自定义呈现回客户端的实际服务页面。或者如果有的话:我很想知道!
As far as I know, no, there's no way to change that right now.
From what I've heard and read, there will be a customizable "help page" mechanism in WCF 4 - but as far as I know, only for REST-based services (which don't have the help of a WSDL/XSD).
Check this out: WCF Web Programming Help Page
For the SOAP based services: you can always define your own custom URL where you drop your WSDL/XSD that should be retrieved by clients, but that's just that - a WSDL that describes your service. You can of course add WSDL comments to your document to explain a bit, but it's still quite limited.
I don't think there's any "out-of-the-box" provision in WCF to support manipulating / customizing the actual service page that gets rendered back to the client. Or if there is: I'd love to know about it!