由于用到方法重载,没想到在web服务中会出现错误:
System.Data.DataTable Get_SendedEmail(Int32, System.String) 和 System.Data.DataTable Get_SendedEmail(Int32) 同时使用消息名称“Get_SendedEmail”。使用 WebMethod 自定义特性的 MessageName 属性为方法指定唯一的消息名称。
原来,必须在方法中指定messagename来用户唯一标识且在类中指示不支持1.1标准
[WebService(Namespace = "http://www.efreer.cn/")]
//[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[WebServiceBinding(ConformsTo = WsiProfiles.None)]
public class email : System.Web.Services.WebService
{
[WebMethod(Description = "发件箱(返回table)",MessageName="qq")]
public DataTable Get_SendedEmail(int userid)
{
return email_BLLSub.Get_SendedEmail(userid);
}
[WebMethod(Description = "发件箱(返回table)", MessageName = "yy")]
public DataTable Get_SendedEmail(int userid,string where)
{
return email_BLLSub.Get_SendedEmail(userid,where);
}
}