我遇到了这个奇怪的问题...
我有一个针对 jQuery 前端运行的 Web 服务。当我通过 VS2008 的集成 Web 服务器运行它时,它运行得很好。 但是当我使用 IIS 本身时 - 我收到此错误:
System.InvalidOperationException: Request format is invalid: application/json; charset=utf-8. at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
AJAX 代码:
$.ajax({
type: "POST",
url: "<a href="http://localhost/MYSITE/WEBSERVICE.asmx/SOME_FUNCTION" rel="noreferrer noopener nofollow">http://localhost/MYSITE/WEBSERVICE.asmx/SOME_FUNCTION</a>",
data: '{ prm1: "' + p1+ '", prm2: "' + p2+ '", prm3: "' + p3+ '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
.....
有什么想法为什么会发生这种情况吗?
该站点是使用“集成托管管道池”的 .NET 3.5。
谢谢, 罗马
最佳答案
得到答案...
我已将 httphandler 和 httpmodule 添加到 web.config,但没有将它们作为处理程序和模块添加到 system.webserver。
也许会对某人有所帮助
罗马
关于ASP.NET 和 jQuery AJAX - 奇怪的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3303372/