.asmx Web服务文档

问题描述:

我希望我的摘要,参数信息,返回信息等(列在下面)显示在.net为.asmx Web服务生成的标准帮助页面上。.asmx Web服务文档

/// <summary> 
/// Brief description 
/// </summary> 
/// <param name="fakeParamOne">Fake Param One Description</param> 
/// <returns>Bool representing foo</returns> 

,我已经试过了影响以任何方式自动生成的帮助页面的唯一的事情是这样的:

[WebMethod(Description = "Does awesome things.")] 

我敢肯定,我失去了一些东西很简单(或它的不可能做我想做的事)。有什么建议么?

+0

有没有自动的方式做你的要求。事实上,WCF中的帮助页面已被放弃,因为它的实用性非常有限。 –

+1

“WCF中的帮助页面已被放弃,因为它的功用非常有限”?请您再说一遍???你在开玩笑我! – Jenda

就像@John Saunders评论中提到的那样,没有一种真正的自动方式来使用XML方法注释来显示在WSDL帮助中,但是有几种替代方法可以获得您想要的内容。

的WebMethod Description属性可以被设置为HTML格式

下面是一个例子:

const string someWebMethodDescription = @" 
<table> 
    <tr> 
     <td>Summary:</td><td>[My Summary]</td> 
    </tr> 
    <tr> 
     <td>Parameters:</td><td>&nbsp;</td> 
    </tr> 
    <tr> 
     <td>fakeParam:</td><td>[My Fake Param Description]</td> 
    </tr> 
</table>"; 

[WebMethod(Description=someWebMethodDescription)] 
public List<string> SomeWebMethod 

其结果为:

Web Method with Custom HTML Description

或者,创建自定义WSDL帮助页面

<configuration> 
    <system.web> 
     <webServices> 
     <wsdlHelpGenerator href="docs/HelpPage.aspx"/> 
     </webServices> 
    </system.web> 
</configuration> 

检查这个CodeProject上的职位的详细信息,使自己的HelpPage:

Improving the ASP.NET Webservice Help Generator to Reflect Inheritance - CodeProject