如果我设置了所有这些属性,我可以很好地下载较小的文件,但是当我尝试下载1-2GB文件时,我只是得到一个400错误的请求错误,这使得它很难调试…
理想情况下,我的服务应支持至少8GB的文件大小.这甚至可以用WCF吗? web.config文件的各种messageSize属性似乎仅限于Int32.MaxValue,它等于最大文件大小2GB.
从我的研究中我发现似乎我将不得不使用WebClient.DownloadFile.
只有具有所需权限的用户才能下载文件.使用WCF,我的下载方法可以采用服务器可以检查的令牌参数,并且仅当用户有权下载所请求的文件时才返回流.使用WebClient方法似乎并不简单.如果有人有关于如何做到这一点的指导(通过WebClient),我将非常感激.
理想情况下,我的WCF服务应该管理并提供用户令牌,并以某种方式绑定到每个单独的文件,令牌当前是合法的(令牌只能使用一次).然后应该通过WebClient进行下载.
提前感谢任何线索.
解决方法
http://msdn.microsoft.com/en-us/library/ms733742.aspx
The strategy to deal with large payloads is streaming. While messages,especially those expressed in XML,are commonly thought of as being relatively compact data packages,a message might be multiple gigabytes in size and resemble a continuous data stream more than a data package. When data is transferred in streaming mode instead of buffered mode,the sender makes the contents of the message body available to the recipient in the form of a stream and the message infrastructure continuously forwards the data from sender to receiver as it becomes available.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。