在Windows 2008 R2 SP1上,asmx的JQuery失败 [英] JQuery to asmx fails on Windows 2008 R2 SP1

查看:192
本文介绍了在Windows 2008 R2 SP1上,asmx的JQuery失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从安装SP1以来,我们在从JQuery客户端代码调用asmx页面时遇到了问题。

Since the installation of SP1 we are facing problems in calling asmx pages from JQuery client code.

IIS将JQuery帖子调用指向他的默认404页面。

IIS is pointing the JQuery post call to his default 404 page.

我们做了我们环境的角色声明此问题是由SP1引起的,测试确认了它。

We did a roleback of our environment to assert this issue is caused by SP1 and tests confirm it.

等待修复@MS

使用的技术:

ASP.Net 4.0 -
JQuery -
IIS 7.5 -
Windows 2008 R2 SP1

ASP.Net 4.0 - JQuery - IIS 7.5 - Windows 2008 R2 SP1

- Bart

代码示例呼叫(前端):

  // Code to load vars...
  $.ajax({

              type: "POST",
              url: "/Handlers/ProductRating.asmx/RateProduct",
              data: "{'uniqueId':'" + uniqueId + "','productId':'" + productId + "','points':" + points.toString() + ",'showOwnScore':" + showOwnScore.toString() + "}",
              contentType: "application/json; charset=utf-8",
              dataType: "json",
              success: function(response) {
                   alert('success');
              },
              failure: function(msg) {
                alert('something went wrong');
              }
            });
        }

代码后端:

 [ScriptService]
public class ProductRating : System.Web.Services.WebService
{

    [WebMethod(EnableSession=true)]
    public RateProductResponse RateProduct(Guid uniqueId, Guid productId, int points, bool showOwnScore)
    {
       //Implementation
    }

Snapshot1:SP1:
http://img812.imageshack.us/i/capture2r.png/

Snapshot1 : With SP1: http://img812.imageshack.us/i/capture2r.png/

Snapshot2:没有SP1:
http://img190.imageshack.us/i/capture1qx.png/

Snapshot2 : Without SP1: http://img190.imageshack.us/i/capture1qx.png/

推荐答案

我能够通过以下添加到我的web.config来实现这一点

I was able to get this working with the following addition to my web.config

我看到另一个建议清理处理程序的网站,但这让事情变得更糟。通过此更新,我可以再次调用我的Web服务。

I saw another site that suggested clearing the handlers, but that made everything way worse. With this update, I was able to call my web services once again.

<system.webServer>
    <handlers>
        <add name="AsmxRoutingHandler" verb="*" path="*.asmx"  type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
</system.webServer>

这篇关于在Windows 2008 R2 SP1上,asmx的JQuery失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆