POST Ajax调用导致IIS6上使用的jqGrid与ASP.NET MVC 2未发现 [英] POST Ajax call results in not found using jqGrid and ASP.NET MVC 2 on IIS6

查看:86
本文介绍了POST Ajax调用导致IIS6上使用的jqGrid与ASP.NET MVC 2未发现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我百思不得其解。我部署了一个MVC 2应用程序IIS6,一切工作正常,除了我的jqGrid调用来获取数据。

This is puzzling me. I deployed an MVC 2 application to IIS6 and everything works fine except for my jqGrid calls to get data.

一切都很好,我的机器上,但这里有两个URL我与

All is well on my development machine, but here are the two URLs I'm working with

本地开发Web服务器:

POST http://localhost:port/Ctrl.mvc/JsonMethod

IIS6(HTTPS通知 - 不知道,如果该事项)

POST https://www.domain.com/AppName/Ctrl.mvc/JsonMethod

后者URL导致一个HTTP 404,这是非常令人困惑,因为所有我的本地机器上运行良好。在 JsonMethod 正确地与宣布的[AcceptVerbs(HttpVerbs.Post)]

让我知道是否需要任何更多的信息 - 我AP preciate任何和这一切帮助

Let me know if any more info is needed - I appreciate any and all help with this!

修改我的一部分很大的一个疏忽。

EDIT Quite an oversight on my part..

我所有的JSON请求是 /Ctrl.mvc/JsonMethod 。好了,在IIS服务器上,在code是在子文件夹 - AppName的。因此,我得到一个404,因为 HTTPS://domain/Ctrl.mvc/JsonMethod 找不到 - 这是正确的。

All of my JSON requests are /Ctrl.mvc/JsonMethod. Well, on the IIS server, the code is in a sub-folder - AppName. As such, I'm getting a 404 because https://domain/Ctrl.mvc/JsonMethod is not found - which is correct.

基本上,我需要改变我的JSON请求,当我部署 - 我真的不喜欢,但也许有一个更好的办法

Basically, I need to change my JSON requests when I deploy - which I really don't like, but perhaps there is a better way?

推荐答案

看<一个href=\"http://stackoverflow.com/questions/239981/deploy-asp-net-mvc-beta-to-iis-6-causing-404s\">http://stackoverflow.com/questions/239981/deploy-asp-net-mvc-beta-to-iis-6-causing-404s和的http://blog.stevensanderson.com/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/.

你有你的应用程序更URL POST的地方使用?难道他们的工作?你有多个URL,而不喜欢的.aspx或.mvc延期?难道他们的工作?

Do you have more URL in your application where POST are used? Are they work? Do you have more URLs without an extension like .aspx or .mvc? Are they work?

更新时间::我曾与像你所有的JavaScript我的网址不同基/根部分的问题。因为你使用jqGrid的,我觉得你有同样的问题。如果我发布在Web服务器上我在一个虚拟目录解决方案,那么它叫我的JavaScript的所有URL将被改变。所以我给 window.location.pathname /,然后我找到了新的<$拆呢C $ C> ROOTPATH​​ 对应于新的位置。网址这样的重订基期我放置在我在我的解决方案的所有JavaScript的内部调用一个函数。租金是code片段,它完美的作品在我的网站:

UPDATED: I had a problem with different base/root parts of my URL in all JavaScripts like you. Because you use jqGrid, I think you have the same problem. If I publish my solution in a virtual directory on a Web Server, then all URLs which call my JavaScripts will be changed. So I give window.location.pathname and split it with '/', then I find out a new rootPath corresponds to the new location. Such rebasing of URLs I placed in a function which I call inside of all JavaScripts of my solution. Hire is code fragment which works perfect on with my site:

var pathArray = window.location.pathname.split( '/' );
var rootPath = '';
for (var i = 0; i < pathArray.length; i++) {
    var p = pathArray[i];
    if (p === "") {
        continue;
    }

    if (p.toLowerCase() !== 'home') {
        rootPath += '/';
        rootPath += p;
    } else {
        break;
    }
}
this.urlBase = rootPath + '/Repository.svc';
this.urlExportBase = rootPath + '/ExportToExcel';

解决方案并不完美,但它的作品。它可以是你应该改变这种垫底的功能,使之与贵方合作。

The solution is not perfect, but it works. It can be that you should change this "rebasing" function to make it working with your side.

这篇关于POST Ajax调用导致IIS6上使用的jqGrid与ASP.NET MVC 2未发现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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