Jquery Post方法在IIS7上有效,但在IIS6上不起作用
我已经开发了运行在Framework4.0上的应用程序。它在我的本地计算机和IIS 7.0上运行良好,但在IIS 6.0上无法运行。我正在犯错误Jquery Post方法在IIS7上有效,但在IIS6上不起作用,jquery,asp.net,iis-6,Jquery,Asp.net,Iis 6,我已经开发了运行在Framework4.0上的应用程序。它在我的本地计算机和IIS 7.0上运行良好,但在IIS 6.0上无法运行。我正在犯错误 {"Message":"An attempt was made to call the method \u0027SendMailMessage\u0027 using a GET request, which is not allowed.","StackTrace":" at System.Web.Script.Services.RestHan
{"Message":"An attempt was made to call the method \u0027SendMailMessage\u0027 using a GET request, which is not allowed.","StackTrace":" at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}
我已在我的代码隐藏代码上设置了以下属性
[WebMethod]
[ScriptMethod(UseHttpGet = false)]
我的Jquery方法
setTimeout(function() {
$.ajax({
cache: false,
type: "POST",
url: "Test.aspx/TestMethod",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
data: JSON.stringify({
"strSubmitDate": $("#txtDate").val()
}),
success: function (data) {
alert(data.d);
$("#floatingBarsG").hide();
},
error: function (xhr, ajaxOptions, thrownError) {
//debugger;
alert(xhr.responseText);
}
});
}, 2000);
感谢您的帮助…提前感谢我记得我遇到过类似的情况,但就我而言,问题是由于生产主机阶段的共享环境造成的。不管of方法是否作为POST发送,主机总是通过GET进行重定向,因此最终我总是收到403 我还发现了它,IIS 4和5中的一个相关错误。
您尝试过这种方法吗?谢谢Angelo的回复。实际上它在我的本地机器上工作正常。当我在Server2003和II6机器上部署IIS7.0时,我得到了这个错误。看起来我在web.config或IIS设置中缺少某些内容我也尝试了GET方法,但得到以下错误:消息:“无效的web服务调用,缺少参数值:\u0027ListName\u0027”。抱歉,键入错误,请改为读取strSubmitDateListName@Vishal,这个的值是多少,$(“#txtDate”).val()在web服务中相同的接收类型是什么?同样对于帖子内容类型应该是application/***表单编码类型谢谢回复。我正在使用IIS6,我得到了不同的错误。我尝试了在这个链接中给出的解决方案,但没有运气…现在感到沮丧…认为它会很简单…是因为我将15个参数传递给t吗他的方法是Jquery。现在我想删除Jquery并用传统方法调用方法背后的代码。。