看看我的这个webservice有什么问题啊,在实例化时出错!!
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
namespace NoxMailService
{
/// <summary>
/// mailsend 的摘要说明。
/// </summary>
[WebService(Namespace="Hello",Description="在Web Services里发送邮件。")]
public class mailsend : System.Web.Services.WebService
{
private string From;
private string To;
private string Subject;
private string Body;
private string AttFile;
private string Cc;
private string Bcc;
private string MailServer;
private string UserType;
private string UserName;
private string Password;
protected string to
{
get
{
return To;
}
set
{
To = value;
}
}
protected string from
{
get
{
return From;
}
set
{
From = value;
}
}
protected string subject
{
get
{
return Subject;
}
set
{
Subject = value;
}
}
protected string body
{
get
{
return Body;
}
set
{
Body = value;
}
}
protected string attfile
{
get
{
return AttFile;
}
set
{
AttFile = value;
}
}
protected string cc
{
get
{
return Cc;
}
set
{
Cc = value;
}
}
protected string bcc
{
get
{
return Bcc;
}
set
{
Bcc = value;
}
}
protected string mailserver
{
get
{
return MailServer;
}
set
{
MailServer = value;
}
}
protected string usertype
{
get
{
return UserType;
}
set
{
UserType = value;
}
}
protected string username
{
get
{
return UserName;
}
set
{
UserName = value;
}
}
protected string password
{
get
{
return Password;
}
set
{
Password = value;
}
}
public mailsend()
{
//CODEGEN: 该调用是 ASP.NET Web 服务设计器所必需的
InitializeComponent();
}
public mailsend(string usertype,string from,string to,string subject,string body,string smtpserver,string username,string password)
{
this.usertype = usertype;
this.from = from;
this.to = to;
this.subject = subject;
this.body = body;
this.mailserver = smtpserver;
this.username = username;
this.password = password;
}
[WebMethod]
public string MailSend()
{
return this.password;
}
#region 组件设计器生成的代码
//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
// WEB 服务示例
// HelloWorld() 示例服务返回字符串 Hello World
// 若要生成,请取消注释下列行,然后保存并生成项目
// 若要测试此 Web 服务,请按 F5 键
// [WebMethod]
// public string HelloWorld()
// {
// return "Hello World";
// }
}
}
在另外一个页面中实例化时出错,出错信息如下 :
c:\inetpub\wwwroot\HOHO\WebForm1.aspx.cs(50): 重载“mailsend”方法未获取“8”参数
localhost.mailsend objs = new HOHO.localhost.mailsend("admin","1","1","1","1","1","1","1");//就是这句报错!!