Restful WCF 数据服务可以上传和下载大文件吗?

发布于 2024-08-31 05:18:23 字数 549 浏览 9 评论 0原文

我正在考虑编写一个能够上传和流式传输大型视频文件(GB)的宁静服务(将来它可能不仅是视频,还可以是大型文档。

到目前为止我进行了研究,什么对我来说真正有意义可能是使用关闭:

WCF 数据服务并实现 IDataServiceStreamProvider ,在后端我想使用新的 SQL 类型 FILESTREAM 将大文件存储到 SQL SERVER 2008 中。看起来我还必须使用一些 Win 32 API 来访问文件系统 SafeFileHandle handle = SqlNativeClient.OpenSqlFilestream

因为 WCF 数据服务喜欢使用 Entity Framework 或 Linq-To-SQL 作为流实现是否支持 SQL Server 文件流类型?

这是计划,但我不知道如何将其组装在一起......我考虑对大文件进行分块并能够恢复和取消

上传:我不确定使用 silverlight 上传控件或其他一些漂亮的 ajax 工具。

任何人都可以在这里为我指明正确的方向...或者您认为这是一条路吗?想法,链接?谁会很棒...

I'm thinking about to write a restful service which is able to upload and stream large video files (GB) (in future it might not only be videos and could also be large documents.

I researched so far and what really makes sense to me could be to use off:

WCF Data Services and Implement IDataServiceStreamProvider and on the back-end I want to Strore the large files into SQL SERVER 2008 using the new SQL Type FILESTREAM.Looks also like I had to use some Win 32 API to access the filesystem SafeFileHandle handle = SqlNativeClient.OpenSqlFilestream

Since WCF Data Services likes to play with Entity Framework or Linq-To-SQL who can be the streaming implementation and is there a support for the SQL Server Filestream Type?

this is the plan but I don't know how to assemble it together... I thougt about chunking the large files and to be able to resume and cancel.

For the upload: I am not sure to use the silverlight upload control or some other nifty ajax tool.

Can anyone point me in the right direction here... or would u think this is this a way to go? Thoughts, Links? whould be great...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

嘿嘿嘿 2024-09-07 05:18:23

我做了一些发送巨大数据文件的事情。我使用这两个示例来帮助编写代码

http://msdn.microsoft。 com/en-us/library/ms751463.aspx

http://www .codeproject.com/KB/WCF/WCFDownloadUploadService.aspx

这是一个非常重要的数字,需要了解 2147483647

I did something where I was sending huge data files. I used these two examples to help write my code

http://msdn.microsoft.com/en-us/library/ms751463.aspx

http://www.codeproject.com/KB/WCF/WCFDownloadUploadService.aspx

This is a very important number to know 2147483647

勿忘初心 2024-09-07 05:18:23

银斗士:
仅在 IIS6 上,我无法配置 WCF 数据服务以通过网络发送超过 30 MB 的流。我相信它不是为大流交易而构建的。只要尝试上传一个 27 MB 的文件并监控相关的 w3wp 进程,您就会对所消耗的内存量感到惊讶。

解决方案是创建一个在其自己的 w3wp 进程下托管的 WCF 服务应用程序,并且仅负责通过 WCF 下载/上传。我建议您使用以下项目 http:// www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP

希望以上内容能有所帮助。

silverfighter:
Only on IIS6, I could not configure WCF Data Services to send more than 30 MB Stream over the network. I believe it is not built for large stream transactions. Just try to upload a 27 MB file and monitor the relevant w3wp process, you will be surprised by the amount of memory consumed.

The solution was to create a WCF Service Application hosted under its own w3wp process and responsible only for download / upload over WCF. i recommend you use the following project http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP

Hope the above could help.

久而酒知 2024-09-07 05:18:23

与问题无关,但与 @Houssam Hamdan 的回答相关:

30 MB 限制不是因为 WCF 数据服务,而是 IIS 的限制,可以通过 IIS 的配置文件和设置进行更改并捕获 IIS 引发的一些异常

Not Related to the question but related to answer of @Houssam Hamdan :

The 30 MB limit is not because of WCF data services but it's IIS's limitation that can be changed through config file and settings of IIS and catching some exceptions thrown by IIS

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文