Answer the question
In order to leave comments, you need to log in
How to remove the limit on uploading large files to an ASP.NET MVC server?
I only upload small files to the server.
Where can I remove this restriction?
I set it in web.config, but even if I put big numbers, files, say 100-200 meters, are not downloaded. Did like here stackoverflow.com/questions/16287706
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="2147483647" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
...
</system.web>
dynamic dyn = JObject.Parse(Params.Data);
dynamic dat = new JObject();
using (var client = new HttpClient())
using (var formData = new MultipartFormDataContent())
using (var fileStream = File.OpenRead(dyn.FullPath.ToString()))
{
HttpContent fileStreamContent = new StreamContent(fileStream);
var filename = Path.GetFileName(dyn.FullPath.ToString());
formData.Add(fileStreamContent, "upload", filename);// загрузка
var response = client.PostAsync("http://localhost:2613/siteapi/postfile?code="+ dyn.Code.ToString(), formData).Result; //Отправка
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question