我正在尝试使用 IIS 7.5 托管 ASP.NET MVC4 Web 应用程序。调试应用程序时一切正常(我假设这是因为 Windows 身份验证)。但是,当我发布应用程序并浏览到它时,我收到 405 Method not allowed 错误:
POST http://localhost/ 405 (Method Not Allowed)
send
i.extend.ajax
i.(anonymous function)
(anonymous function)
从我一直在阅读的内容来看,这要么是 IIS 中的处理程序映射问题,要么是 web.config 中需要一些配置。无论哪种方式,我都没有找到正确的解决方案。谁能告诉我我的 web.config 应该包含在所有 POSTS 中的内容吗?和/或如何在 IIS 中设置正确的处理程序映射,因为我是 Web 开发的新手,发现选项数量有点压倒性。
引发错误的 javascript 片段如下:
$.post("/", { latitude: locLat, longitude: locLon, username: $('#onlineUsers').attr('itemid') });