简体   繁体   English

如何使用XMLHttpRequest和asp.net MVC将较大的Blob发布到服务器?

[英]How post a large blob to server using XMLHttpRequest and asp.net MVC?

I am using your RecordRTC in mvc to record and post large size video. 我正在Mvc中使用您的RecordRTC来录制和发布大尺寸视频。 It works fine when I have 2-3 min recording but fails to post when I have around 8-10 min recording.I can see 404 controller action in this case. 当我有2-3分钟的记录时,它可以正常工作,但是当我有8-10分钟的记录时,它却无法发布。在这种情况下,我可以看到404控制器动作。

var formData = new FormData(); 
formData.append(fileType + '-filename', fileName); 
formData.append(fileType + '-blob', blob); 
var request = new XMLHttpRequest(); 
request.open('POST', '/Admin/Videos/PostRecordedAudioVideo'); 
request.send(formData);

In your webconfig file add the below line into the <system.web> tag 在您的webconfig文件中, webconfig添加到<system.web>标记中

<httpRuntime targetFramework="4.5" executionTimeout="6000000" maxRequestLength="2147483647" />

It will allow to upload large file size at the server. 它将允许在服务器上上传大文件。 It just extend the limit 4MB to 2GB and it also extends the execution timeout. 它只是将限制从4MB扩展到2GB ,并且还延长了执行超时。 So if your file is large than it takes time to upload. 因此,如果文件很大,则上传需要花费时间。

You does not posted the code so, I assume that you can not added the above line of code into your webconfig . 您没有发布代码,因此,我假设您不能将上述代码行添加到webconfig

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM