加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

Uploadify for ASP.NET app返回大型文件的HTTP错误

发布时间:2020-12-16 09:53:19 所属栏目:asp.Net 来源:网络整理
导读:我的Uploadify脚本适用于大多数小于10 MB的文件.但是一旦文件大小开始超过40 MB,它将无法上传,只有“HTTP错误”的错误消息.我尝试为Uploadify实现onError处理程序,但它没有给我任何详细信息确切的错误.变量返回“未定义”.我检查了我的web.config文件,文件大
我的Uploadify脚本适用于大多数小于10 MB的文件.但是一旦文件大小开始超过40 MB,它将无法上传,只有“HTTP错误”的错误消息.我尝试为Uploadify实现onError处理程序,但它没有给我任何详细信息确切的错误.变量返回“未定义”.我检查了我的web.config文件,文件大小限制设置为50 MB,我有30分钟的超时,所以我不知道问题是什么.这是我的脚本:

$('#uploader').uploadify({
  'uploader': '/js/uploadify/uploadify.swf','script': '/cms/common/uploadify/UploadHandler.ashx','cancelImg': '/images/cancel_upload.png','buttonImg': '/images/select_video_thumbnail_en-us.gif','auto': true,'folder': '/Temp','multi': false,'sizeLimit': 0,'displayData': 'percentage','simUploadLimit': 1,'fileExt': '*.jpg;*.gif;*.png','fileDesc': '*.jpg;*.gif;*.png','buttonText': 'Select thumbnail...','width': '120','height': '24','onComplete': function (e,queueId,fileObj,response,data)
  {
    return true;
  },'onError': function (a,b,c,d)
  {
    if (d.status == 404)
      alert('Could not find upload script.');
    else if (d.type === "HTTP")
      alert('error ' + d.type + ": " + d.status);
    else if (d.type === "File Size")
      alert(c.name + ' ' + d.type + ' Limit: ' + Math.round(d.sizeLimit / 1024) + 'KB');
    else
      alert('error ' + d.type + ": " + d.text);
  },'onCancel': function (e,data)
  {

  }
});

解决方法

我正在运行的IIS7的默认内部文件大小限制为30 MB.将maxRequestLength设置为大于此值将无济于事.通过将以下内容添加到web.config文件来解决此问题:

<system.webServer>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="50000000"/>
            </requestFiltering>
        </security>
</system.webServer>

这也可以在IIS7中设置.有关更多详细信息,请参阅以下链接:
IIS7 File Upload Size Limits
Enabling Request Filtering In IIS 7

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读