otrzymuję następujący błąd „Web Service nazwa metody jest nieprawidłowy” podczas próby wywołania WebMethod z javascriptWeb nazwa metody obsługę nie obowiązuje
System.InvalidOperationException: SaveBOAT Web Service nazwa metody jest nieprawidłowy . w System.Web.Services.Protocols.HttpServerProtocol.Initialize() w System.Web.Services.Protocols.ServerProtocol.SetContext (typ typu, kontekst HttpContext, żądanie HttpRequest, odpowiedź HttpResponse) w System.Web.Services.Protocols .ServerProtocolFactory.Create (typ Type, HttpContext kontekst, HttpRequest prośba, HttpResponse odpowiedź, Boolean & abortProcessing)
HTML kod:
<asp:LinkButton runat="server" ID="lnkAddBoat" OnClientClick="javascript:AddMyBoat(); return false;"></asp:LinkButton>
JS Kod:
function AddMyBoat() {
var b = document.getElementById('HdnControlId').value;
jQuery.ajax({
type: "GET",
url: "/AllService.asmx/SaveBOAT",
data: { Pid: b },
contentType: "application/text",
dataType: "text",
success: function(dd) {
alert('Success' + dd);
},
error: function(dd) {
alert('There is error' + dd.responseText);
}
});
}
kod C# (metoda Web w pliku AllService.asmx)
[WebMethod]
public static string SaveBOAT(int Pid)
{
// My Code is here
//I can put anythng here
SessionManager.MemberID = Pid;
return "";
}
Próbowałem wszystkie znalezione na przepełnienie stosu i ASP.NET rozwiązania site.but żaden z nich nie pracował mnie.
w moim przypadku brak jest słowa kluczowego publicznego – Naga