I have an ASP.NET Web API written in MVC. I have a post action with some optional arguments.
public Guid PostExecution(string Action, List<Guid> ComputersIDs, int Port = 0, string Command = null, string Password = null)
It works perfectly. Now I need this action to receive an optional file sent through the post method.
So:
public Guid PostExecution(string Action, List<Guid> ComputersIDs, int Port = 0, string Command = null, string Password = null, HttpPostedFileBase file = null)
The interesting thing is that when I add the parameter HttpPostedFileBase
the servers stops the responds the requests to this action and only says Error 500 Internal Server error. It doesn't thrown any exception. With a breakpoint the code doesn't enter to the PostExecution
.
Why does this happen?
How can I debug this error?
Is it possible to have an optional HttpPostedFileBase
?