【发布时间】:2013-09-20 03:34:05
【问题描述】:
我有一个用 MVC 编写的 ASP.NET Web API。 我有一个带有一些可选参数的发布操作。
public Guid PostExecution(string Action, List<Guid> ComputersIDs, int Port = 0, string Command = null, string Password = null)
完美运行。现在我需要这个动作来接收一个通过 post 方法发送的可选文件。
所以:
public Guid PostExecution(string Action, List<Guid> ComputersIDs, int Port = 0, string Command = null, string Password = null, HttpPostedFileBase file = null)
有趣的是,当我添加参数HttpPostedFileBase 时,服务器停止响应对此操作的请求,并且只显示错误 500 内部服务器错误。它没有抛出任何异常。使用断点代码不会进入PostExecution。
为什么会这样?
如何调试此错误?
是否可以有一个可选的HttpPostedFileBase?
【问题讨论】:
标签: c# asp.net-mvc asp.net-mvc-4 asp.net-mvc-3 asp.net-web-api