【发布时间】:2013-04-21 00:18:29
【问题描述】:
我有一个在开发环境中工作的 MVC4 WebApi 项目,但在部署到生产环境时出错。 执行 POST 时出现 httperror 405,执行 GET 时出现 404 错误。我知道问题是我的路线由错误的模块提供服务,但无法找出问题所在。
这是 POST 的失败请求日志
ModuleName DirectoryListingModule
Notification 128
HttpStatus 405
HttpReason Method Not Allowed
HttpSubStatus 0
ErrorCode 2147942401
ConfigExceptionInfo
Notification EXECUTE_REQUEST_HANDLER
ErrorCode Incorrect function. (0x80070001)
这是 GET 的失败请求日志
ModuleName IIS Web Core
Notification 16
HttpStatus 404
HttpReason Not Found
HttpSubStatus 0
ErrorCode 2147942402
ConfigExceptionInfo
Notification MAP_REQUEST_HANDLER
ErrorCode The system cannot find the file specified. (0x80070002)
我在板上尝试了许多解决方案,但没有一个能解决我的问题。 我的环境是Server 2008 R2,IIS7,我重新安装了.Net 4.0 framework,MVC 4。没有安装WEBDAV,我在web.config中有。 我已确保 appPool 在 .net 4.0 下以集成模式运行我还确保已安装所有 Windows 更新。
知道我还能尝试什么吗?非常感谢。
【问题讨论】:
-
我原来的帖子有问题。我在 web.config 中运行了AllManagedModulesForAllRequests="true"
-
我通过更改控制器中的 POST 操作以接受具有适当参数作为属性而不是值类型作为方法参数的复杂对象来解决此问题。
标签: c# .net asp.net-mvc asp.net-web-api http-status-code-405