需要 JQuery asmx 调试帮助

发布于 2024-11-29 11:05:51 字数 1774 浏览 1 评论 0原文

如果我能得到任何帮助,我将不胜感激。在我的本地开发中,我能够成功地测试这一点,但是我将相同的代码移到另一台机器上,它似乎不起作用,并且在远程上调试也很困难。所有代码应该做的就是将数据发送到服务器进行处理,但由于某种原因,这根本不起作用。我在服务器端拥有的只是一个框架方法,用于获取发送的任何数据并将其吐出,但由于某种原因,客户端每次都会吐出一个错误,执行下面的代码。

“处理请求时出错。”

function getusersbyselectedrole() {
                alert(role_filter);//check to be sure data is being collected 
                alert("{role :\"" + role_filter + "\"}"); //check to be sure the ride data is being sent to serve
                alert("<%= ReportsLink %>/LoadUsersByRole");//check to be sure the right service address is being used
                $.ajax({
                type: "POST", 
                    url: "<%= ReportsLink %>/LoadUsersByRole",
                    data: "{role :" + role_filter + "}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function(msg) {
                        $("#<%= sUsers.ClientID %>").append($("<option></option>").attr("value", "-1").text("select user"));
                        $.each(msg, function(key, value) {
                            $("#<%= sUsers.ClientID %>").append($("<option></option>").attr("value", key).text(value));
                        });
                    },
                    error: function(res, status) {
                        if (status === "error") {
                            // errorMessage can be an object with 3 string properties: ExceptionType, Message and StackTrace
                            var errorMessage = $.parseJSON(res.responseText);
                            alert(errorMessage.Message);
                        }
                    }
                });
            }

I would appreciate any help I can get with this please. In my local dev, I am able to test this successfully, but I moved the same code to another machine and it does not seem to be working, and debugging is hard on the remote as well. All the code ought to do is send data to the server for processing, but for some reason, this is not working at all. All I have on the server end is a skeleton method to get whatever data is sent and spit it back out but for some reason, the client end spits back an error each time, the code below is executed.

"There was an error processing the request."

function getusersbyselectedrole() {
                alert(role_filter);//check to be sure data is being collected 
                alert("{role :\"" + role_filter + "\"}"); //check to be sure the ride data is being sent to serve
                alert("<%= ReportsLink %>/LoadUsersByRole");//check to be sure the right service address is being used
                $.ajax({
                type: "POST", 
                    url: "<%= ReportsLink %>/LoadUsersByRole",
                    data: "{role :" + role_filter + "}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function(msg) {
                        $("#<%= sUsers.ClientID %>").append($("<option></option>").attr("value", "-1").text("select user"));
                        $.each(msg, function(key, value) {
                            $("#<%= sUsers.ClientID %>").append($("<option></option>").attr("value", key).text(value));
                        });
                    },
                    error: function(res, status) {
                        if (status === "error") {
                            // errorMessage can be an object with 3 string properties: ExceptionType, Message and StackTrace
                            var errorMessage = $.parseJSON(res.responseText);
                            alert(errorMessage.Message);
                        }
                    }
                });
            }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

攒眉千度 2024-12-06 11:05:51

您要将其部署到 IIS 6 吗?如果是这样,问题在于该请求没有任何到 ASP.NET 的映射。您可以在 IIS 6 中解决该问题(见下文),或者只是将 .asmx 添加到您的 URL。它应该已经映射到 Web 服务调用(除非您使用 MVC,在这种情况下您必须将 .asmx 添加到路由规则中)。

http:// /haacked.com/archive/2010/12/22/asp-net-mvc-3-extensionless-urls-on-iis-6.aspx

Are you deploying this to IIS 6? If so, the problem is that the request doesn't have any mapping to ASP.NET. You could either fix the problem in IIS 6 (see below), or just add .asmx to your URL. It should already be mapped to web service calls (unless you are using MVC in which case you would have to add .asmx to your routing rules).

http://haacked.com/archive/2010/12/22/asp-net-mvc-3-extensionless-urls-on-iis-6.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文