调用webservice接口 怎么去掉账号密码验证
1、如果发布的webservice接口,需要账号密码验证,我们改下其代码即可。

2、namespace WebService1
{
/// <summary>
/// Service1 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]

3、 // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}

4、 public string show(string yourname)
{
return "http://www.ourfly.com" + "欢迎" + yourname;
}
public SqlConnection GetConn()
{
SqlConnection conn = new SqlConnection("server=LEAD100SERVER;database=Indagate;uid=lxy;pwd=liu");
return conn;
}
public DataTable DBSelect(string sql)
{

5、 SqlDataAdapter sda = new SqlDataAdapter(sql,GetConn());
DataTable dt = new DataTable();
sda.Fill(dt);
return dt;
}
public void DBExcute(string sql)
{
SqlConnection conn = GetConn();
conn.Open();
try
{
SqlCommand comm = new SqlCommand(sql,conn);
comm.ExecuteNonQuery();
}
catch
{
}
conn.Close();
}
}
}
