我有一个用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
,服务器停止响应该操作的请求,并仅显示Error 500 Internal Server error。它不会引发任何异常。带有断点的代码不会输入到中PostExecution
。
为什么会这样?
如何调试此错误?
是否可以有一个可选的HttpPostedFileBase
?
所有发布的文件都是可选的!
您可以通过来获取它们Request.Files
,而不必将它们包含在methods参数中
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句