Reputation: 1499
This is my web service.... and requested from jquery ajax.. but I am there is an error I dont know What it is?
Error Unknown web method mobilcevapGetir. Parameter name: methodName I guess Everythings is ok but I dont know..
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[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);
}
Upvotes: 0
Views: 79
Reputation: 11
If you put a breakpoint in your service method, does it get called and does it execute successfully? Guessing everything is ok probably means everything isn't ok! You don't appear to be specifying a server name in your connection string, for example.
Upvotes: 1