asp.net-mvc - "' Sys ' is undefined"在 IIS7 中运行 ASP.NET MVC 应用程序时出错

标签 asp.net-mvc iis iis-7

我在我的 Web 应用程序中使用 ASP.NET MVC。它使用 AJAX(MicrosoftAjax.js、MicrosoftMvcAjax.js、jquery-1.3.1.min.js)通过以下代码从 View 调用删除操作:

<%= Ajax.ActionLink("Delete", "Delete", new { id=item.id }, new AjaxOptions { Confirm = "Are you sure you want to delete the record?", HttpMethod = "Delete", UpdateTargetId = "divAttributeList" }) %>

在 Controller 中我使用这段代码来处理 View 请求:

[AcceptVerbs(HttpVerbs.Delete)]
    public ActionResult Delete(int id)
    {
        _service.DeleteAttribute(id);

        return PartialView("List", _service.ListAttributes());
    }

当我在 ASP.NET Development Server 上运行它时效果很好,但是当我尝试在 IIS7(Windows Vista 或 Windows Server 2008)上运行该应用程序时出现错误

alt text

如果我按继续,浏览器会显示下一条消息

找不到资源。

感谢您的帮助。

最佳答案

我会查看 javascript 包含的路径,以确保它们对于 IIS7 中使用的路径是正确的。我已经开始使用 Url.Content() 来确保相对于应用程序的根路径正确定义了我的路径。

 <script type='text/javascript'
         src='<%= Url.Content( "~/Scripts/jquery-1.3.1.min.js" ) %>'>
 </script>

关于asp.net-mvc - "' Sys ' is undefined"在 IIS7 中运行 ASP.NET MVC 应用程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/655954/

相关文章:

asp.net-mvc - Razor 转义冒号内联

asp.net-mvc - 使用 MSpec 测试 ActionFilterAttributes

asp.net - 单击 ASP.NET 4.0 应用程序上的任何按钮都没有回发

javascript - Android 上忽略的特殊字符

iis-7 - 第一次调用时 WCF 性能变慢

c# - mvcsitemapprovider - 从不同的页面导航到相同的 ActionResult

asp.net-mvc - 如何将参数传递给 mvc 4 中的局部 View

tomcat - 强制使用 SSL 的 ARR 代理到 tomcat

IIS 7.5 和 Web API 2 PUT/DELETE 请求

asp.net - Http 处理程序在 iis express 中工作,而在 iis 服务器中不工作