JQuery $ .post在VS 2010实例中工作,但在IIS 7.5中部署时则不行

Inf*_*ner 5 javascript c# ajax jquery asp.net-mvc-3

我已经检查了$ .Post中的网址,没关系.我还检查了连接字符串.除了一个$ .post命令外,整个网站的所有功能都很好,包括$ .ajax命令.我一直收到"保存记录时出错"的消息.

我的代码是在jquery对话框的Save按钮上:

var post = $.post(url,
                        $("#myview").serialize(),
                        function () {
                            thisDialog.dialog("close");
                        });
                        post.error(function (xhr, ajaxOptions, thrownError) {
            alert("Error while saving the record");
Run Code Online (Sandbox Code Playgroud)

当我在调试模式下运行时,这适用于本地VS实例,但是当我将网站部署到IIS 7.5时,它不会运行.有人可以指导问题是什么吗?所有的dll都存在,网址也很好

网址是:主页/开始

[HttpPost]
    public ActionResult Start(StartModel model, FormCollection collection)
            {
                try
                {
                    Service.Create(model);
                    return RedirectToAction("List");
                }
Run Code Online (Sandbox Code Playgroud)

这适用于VS但不适用于IIS 7.5

我收到错误代码500

堆栈跟踪显示错误消息:SqlDateTime溢出.必须在1/1/1753 12:00:00 AM和12/31/9999 11:59:59 PM之间

我使用jquery日期控件设置日期值.任何指导都很感激.

Cla*_*Boy 0

没有更多信息,我只是在黑暗中进行尝试,但您可能正在使用相对 URL,例如/bob/fred,并且服务器具有与本地应用程序不同的文件结构。

假设您的应用程序具有以下结构:

/bob/fred <- the directory you're accessing in the $.post call
/jim/index.aspx <- the page you're calling $.post in
Run Code Online (Sandbox Code Playgroud)

当您将其放在服务器上时,从应用程序根开始的文件结构如下所示:

/site/bob/fred
/site/jim/index.aspx
Run Code Online (Sandbox Code Playgroud)

当通过 VS 2010 运行应用程序时,这是正确的。但是在服务器上它需要不同的 URL。

下一步应该是使用 Firebug 检查 $.post 调用 - 看看是否收到 404。如果是这样,上述信息应该有所帮助。如果没有,请发布更多代码。