I am writing a controller to copy FileStream
content and I am getting error The Client Disconnected
at below line,
await Request.Content.CopyToAsync(fs);
What could be the reason?
public async Task<IHttpActionResult> Post()
{
try
{
string path = @"C:\Test";
using (FileStream fs = new FileStream(path, FileMode.CreateNew, FileAccess.Write))
{
await Request.Content.CopyToAsync(fs);
}
return Ok<bool>(true);
}
catch (Exception ex)
{
throw ex;
}
}