Asp.net mvc 3 使用jquery调用webservice方法时出现页面未找到错误
我在MVC web应用程序的根文件夹中创建了一个WebService目录,并创建了一个名为MyService.asmx的WebService。在这个文件中,我创建了一个UpdateReadCount方法,我使用下面的代码从javascript调用它Asp.net mvc 3 使用jquery调用webservice方法时出现页面未找到错误,asp.net-mvc-3,jquery,Asp.net Mvc 3,Jquery,我在MVC web应用程序的根文件夹中创建了一个WebService目录,并创建了一个名为MyService.asmx的WebService。在这个文件中,我创建了一个UpdateReadCount方法,我使用下面的代码从javascript调用它 function updateReadCount(contentID) { $.ajax({ type: "POST", url: "/WebServices/MyService.asmx/UpdateRea
function updateReadCount(contentID) {
$.ajax({
type: "POST",
url: "/WebServices/MyService.asmx/UpdateReadCount",
data: "{'contentID': '" + contentID + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (json) {
//$("#" + messageView).html(json.d);
}
});
}
我得到页面未找到错误。这种情况发生在托管页面上,而它在本地主机上运行得非常好。为什么要将.asmx与MVC应用程序一起使用?您可以为此执行一个干净的控制器操作 它可能是主域或url Issue签入webconsole