這是我的網絡服務....並要求從jquery ajax ..但我有一個錯誤我不知道它是什麼?關於Web服務?
錯誤未知的web方法mobilcevapGetir。參數名稱:methodName我想Everythings是好的,但我不知道..
在執行當前Web請求期間生成未處理的異常。關於異常的來源和位置的信息可以使用下面的異常堆棧跟蹤來標識。
[WebService(Namespace = "http://microsoft.com/webservices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class mobilSoru
{
public int ID { get; set; }
public string Text { get; set; }
public List<mobilCevap> Answers = new List<mobilCevap>();
}
public class mobilCevap
{
public int cvpID { get; set; }
public int cevapID { get; set; }
public string Text { get; set; }
}
[WebMethod(Description = "Mobile User Registration Service")]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string mobilcevapGetir()
{
var mobilSorular = new List<mobilSoru>();
SqlConnection cnn = new SqlConnection("server=;database=arabamm;uid=e;pwd=");
SqlConnection cNnn = new SqlConnection("server=;database=arabamm;uid=;pwd=");
SqlCommand cmd = new SqlCommand("sorulariGetir", cnn);
cmd.CommandType = CommandType.StoredProcedure;
cnn.Open();
SqlDataReader dr = cmd.ExecuteReader();
ArrayList sayilar = new ArrayList();
while (dr.Read())
{
sayilar.Add(dr[0]);
mobilSorular.Add(new mobilSoru { ID = (int)dr[0], Text = (string)dr[1] });
}
cnn.Close();
for (int i = 0; i < sayilar.Count; i++)
{
SqlCommand cmDd = new SqlCommand("cevaplariGetir", cNnn);
cmDd.CommandType = CommandType.StoredProcedure;
cmDd.Parameters.AddWithValue("@cvpId", mobilSorular[i].ID);
cNnn.Open();
SqlDataReader oku = cmDd.ExecuteReader();
while (oku.Read())
{
mobilSorular[i].Answers.Add(new mobilCevap { cvpID = (int)oku[0], cevapID = (int)oku[1], Text = (string)oku[2] });
}
cNnn.Close();
}
JavaScriptSerializer jSs = new JavaScriptSerializer();
return jSs.Serialize(mobilSorular);
}
您的方法似乎不在您的Web服務類中。 – tvanfosson 2011-05-05 11:19:19