igUpload 上传大文件失败
Upload File with big size fails in igUpload
我正在使用 Infragistics 的 igUpload 上传多个文件。当文件大小小于 3 MB 时一切正常,但是当我尝试上传更大的文件时,它失败了并且 returns 这个错误
Could not get your current file status! Probably connection dropped
我还将 uploadUtilsBufferSize 更改为 10485760,但仍然无法处理更大的文件。以下是 igUplaod
的配置
Button.igUpload({
mode: 'multiple',
multipleFiles: true,
AutoStartUpload: false,
progressUrl: "IGUploadStatusHandler.ashx",
controlId: "upload1",
labelUploadButton: "Upload",
onError: function(evt, ui) {
if (ui.errorType == "serverside") {
ErrorMessage.append("<p>" + ui.serverMessage + "</p>");
} else if (ui.errorType == "clientside") {
ErrorMessage.append("<p>" + ui.errorMessage + "</p>");
}
}
});
IIS Web 服务器上有最大请求长度限制。对于 IIS 6,它是 4 MB(详细信息 here). For IIS 7 and newer is 28.6 MB (details here)。
根据您使用的 IIS 版本,尝试 web.config 中的以下设置:
IIS 6 (web.config):
<system.web>
<httpHandlers>
<add verb="GET" type="Infragistics.Web.Mvc.UploadStatusHandler"
path="IGUploadStatusHandler.ashx" />
</httpHandlers>
<httpModules>
<add name="IGUploadModule" type="Infragistics.Web.Mvc.UploadModule" />
</httpModules>
<!--OPTIONAL: Set the maximum request length.
By default the request lenght is 4 MB.
More info: http://msdn.microsoft.com/en-us/library/e1f13641(v=vs.85).aspx-->
<httpRuntime executionTimeout="3600" maxRequestLength="2097151000"/>
</system.web>
IIS 7(及更高版本)(web.config):
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="IGUploadModule" type="Infragistics.Web.Mvc.UploadModule"
preCondition="managedHandler" />
</modules>
<handlers>
<add name="IGUploadStatusHandler" path="IGUploadStatusHandler.ashx" verb="*"
type="Infragistics.Web.Mvc.UploadStatusHandler" preCondition="integratedMode" />
</handlers>
<security>
<requestFiltering>
<!--OPTIONAL: Set the maximum request length.
By default the request lenght is ~30 MB.
More info: http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits-->
<requestLimits maxAllowedContentLength="2097151000"/>
</requestFiltering>
</security>
</system.webServer>
P.S.: 此信息记录在 Ignite UI 帮助 here.
中
当我试图上传到的目录没有足够的权限供配置的 IIS 用户使用时,我也收到了这条消息。在我的例子中,授予 IIS_IUSR 对文件夹的写权限解决了我的问题。
我正在使用 Infragistics 的 igUpload 上传多个文件。当文件大小小于 3 MB 时一切正常,但是当我尝试上传更大的文件时,它失败了并且 returns 这个错误
Could not get your current file status! Probably connection dropped
我还将 uploadUtilsBufferSize 更改为 10485760,但仍然无法处理更大的文件。以下是 igUplaod
的配置Button.igUpload({
mode: 'multiple',
multipleFiles: true,
AutoStartUpload: false,
progressUrl: "IGUploadStatusHandler.ashx",
controlId: "upload1",
labelUploadButton: "Upload",
onError: function(evt, ui) {
if (ui.errorType == "serverside") {
ErrorMessage.append("<p>" + ui.serverMessage + "</p>");
} else if (ui.errorType == "clientside") {
ErrorMessage.append("<p>" + ui.errorMessage + "</p>");
}
}
});
IIS Web 服务器上有最大请求长度限制。对于 IIS 6,它是 4 MB(详细信息 here). For IIS 7 and newer is 28.6 MB (details here)。
根据您使用的 IIS 版本,尝试 web.config 中的以下设置:
IIS 6 (web.config):
<system.web>
<httpHandlers>
<add verb="GET" type="Infragistics.Web.Mvc.UploadStatusHandler"
path="IGUploadStatusHandler.ashx" />
</httpHandlers>
<httpModules>
<add name="IGUploadModule" type="Infragistics.Web.Mvc.UploadModule" />
</httpModules>
<!--OPTIONAL: Set the maximum request length.
By default the request lenght is 4 MB.
More info: http://msdn.microsoft.com/en-us/library/e1f13641(v=vs.85).aspx-->
<httpRuntime executionTimeout="3600" maxRequestLength="2097151000"/>
</system.web>
IIS 7(及更高版本)(web.config):
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="IGUploadModule" type="Infragistics.Web.Mvc.UploadModule"
preCondition="managedHandler" />
</modules>
<handlers>
<add name="IGUploadStatusHandler" path="IGUploadStatusHandler.ashx" verb="*"
type="Infragistics.Web.Mvc.UploadStatusHandler" preCondition="integratedMode" />
</handlers>
<security>
<requestFiltering>
<!--OPTIONAL: Set the maximum request length.
By default the request lenght is ~30 MB.
More info: http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits-->
<requestLimits maxAllowedContentLength="2097151000"/>
</requestFiltering>
</security>
</system.webServer>
P.S.: 此信息记录在 Ignite UI 帮助 here.
中当我试图上传到的目录没有足够的权限供配置的 IIS 用户使用时,我也收到了这条消息。在我的例子中,授予 IIS_IUSR 对文件夹的写权限解决了我的问题。