[WebMethodAttribute(true)]是什么意思?

gnaw777 2003-07-24 09:42:11
下面是atton.asmx.cs文件,在这个文件中add方法上有[WebMethodAttribute(true)]
这句话,我知道是把add方法声明为XML Web Services方法,
但为为什么不用[WebMethod],还有[WebMethodAttribute(true)]这句话具体是什么意思,为什么加true
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Web;
using System.Web.Services;
using System.Xml;

namespace MyWebService
{
[WebService(Namespace="http://localhost/MyWebService/")]
public class Atton: System.Web.Services.WebService
{
private Glad glad;
public atton()
{
InitializeComponent();
glad= new Glad(base.Application);
}

#region Component Designer generated code

//Web 服务设计器所必需的
private IContainer components = null;

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{

}

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion
[WebMethodAttribute(true)]
public DataSet add()
{
return glad;
}
}
}
...全文
147 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
haowork1977 2003-12-23
  • 打赏
  • 举报
回复
以后我再也不来csdn了,问的都是什么问题啊?msdn上比这详细多了,奉劝各位多看看msdn再来提问吧
pipibug 2003-07-29
  • 打赏
  • 举报
回复
o
wzs_wzs123 2003-07-24
  • 打赏
  • 举报
回复
向使用 ASP.NET 创建的 XML Web services 中的某个方法添加此特性后,就可以从远程 Web 客户端调用该方法。无法继承此类。

有关此类型所有成员的列表,请参阅 WebMethodAttribute 成员。

ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfsystemwebserviceswebmethodattributeclasstopic.htm

111,097

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧