使用 SWFUploader 在 Windows Azure Webrole 上上传大文件(最大 2GB)
我有一个应用程序,因为我想上传最大可达 2GB 的大文件,处理该文件后我想将其作为 blob 存储在 blobstorage 上。我正在使用 SWFUploader 上传文件(我想显示进度条,这是必须的)。
问题是,我无法上传超过 100 MB 的文件。上传最大 100 MB(或有时 90-95 MB)的文件后,它会重新启动整个上传过程,有时会失败。我正在使用 Webrole 项目来完成整个任务。
所以我的问题是:我可以在 Windows azure webrole 项目(基本上是其 Asp.net 网站,所以我想在网络服务器上上传文件)上上传这么大的文件并在那里处理它,然后将其上传到 blobstorage 吗?
据我所知,我做了以下事情:
1:我在 web.config 中设置了以下参数
<security>
<requestFiltering>
<!--maxAllowedContentLength in bytes-->
<requestLimits maxAllowedContentLength="2147483648"></requestLimits>
</requestFiltering>
</security>
<httpRuntime executionTimeout="999999" maxRequestLength="2097152"/>
2:我更改了 ASP.Net 的默认 TMP/TEMP 文件夹(大小为 100 MB)默认)到我使用下面的代码片段在本地存储资源中创建的新文件夹
我创建了这个“CustomTempLocalStore”,然后
<LocalStorage name="CustomTempLocalStore" cleanOnRoleRecycle="false" sizeInMB="1024" />
通过在 onstart() 中设置以下代码将此本地存储资源设置为用作 TMP/TEMP网络角色的方法。
string customTempLocalResourcePath = RoleEnvironment.GetLocalResource("CustomTempLocalStore").RootPath;
Environment.SetEnvironmentVariable("TMP", customTempLocalResourcePath);
Environment.SetEnvironmentVariable("TEMP", customTempLocalResourcePath);
我在以下链接中找到了这个: http://msdn.microsoft.com/en-us/library/dd573354.aspx
仍然无法正常工作,SWFUploader 给出以下错误:
服务器(IO)错误
有什么想法吗?
I have an application, in that I want to upload a large file max up to 2GB, and after processing this file I want to store it as blob on blobstorage. I am using SWFUploader to upload the files (I want to show progress bar, which is must).
The problem is, I am unable to upload a file more than 100 MB. After uploading a file up to 100 MB (or sometimes 90-95 MB) it restarts the whole uploading process and sometimes it just fails. I am using a Webrole project, for this entire task.
So my question is: Can I upload such large file on windows azure webrole project (basically its Asp.net website, so i want to upload a file on webserver) and process it over there and then upload it to blobstorage?
According to my knowledge I did following things:
1: I have set following parameters in web.config
<security>
<requestFiltering>
<!--maxAllowedContentLength in bytes-->
<requestLimits maxAllowedContentLength="2147483648"></requestLimits>
</requestFiltering>
</security>
<httpRuntime executionTimeout="999999" maxRequestLength="2097152"/>
2: I have changed default TMP/TEMP folder of ASP.Net(which is 100 MB by default) to new folder that i have created in local storage resuorces by using follwiing code snippet
I have created this "CustomTempLocalStore" as
<LocalStorage name="CustomTempLocalStore" cleanOnRoleRecycle="false" sizeInMB="1024" />
then set this local storage resources to use as TMP/TEMP by setting following code in onstart() menthod of webrole.
string customTempLocalResourcePath = RoleEnvironment.GetLocalResource("CustomTempLocalStore").RootPath;
Environment.SetEnvironmentVariable("TMP", customTempLocalResourcePath);
Environment.SetEnvironmentVariable("TEMP", customTempLocalResourcePath);
I found this on follwing link:
http://msdn.microsoft.com/en-us/library/dd573354.aspx
Still its not working, the SWFUploader is giving follwing error:
Server(IO)Error
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
默认情况下,Windows Azure 上的本地存储限制为 100MB。至少在这个时候 博客文章,详细解释了如何解决该问题。
By default, local storage on Windows Azure is limited to 100MB. At least it was at the time of this blog post, which explains in detail how to work around it.
您可以使用 Azure Blobs 共享签名来允许客户端直接在 Blob 上写入:
http://convective.wordpress.com/2010/01/20/access-control-for-azure-blobs/
干杯。
You can use Azure Blobs shared signature to allow the client write directly on the blob:
http://convective.wordpress.com/2010/01/20/access-control-for-azure-blobs/
Cheers.
这是MSDN 文章 解释 100 MB TEMP 文件夹限制,并给出一个简单的解决方法,其中涉及重定向 TEMP 目录(与 Dave 的答案不同)。
Here is an MSDN article explaining the 100 MB TEMP folder limit, and giving a simple workaround, which involves redirecting the TEMP directory (different to Dave's answer).