在 Silverlight 应用程序中将大文件上传到 Sharepoint

发布于 2024-10-04 10:39:04 字数 394 浏览 0 评论 0原文

我已经尝试了大约十几种从 silverlight 应用程序将文件上传到共享点的不同方法。它们要么有严格的限制(文件大小限制小于一兆左右),要么有许多我无法克服的安全问题。我已经尝试过:

  • WCF(我们试图完全不使用任何自定义WCF服务,仅供参考,尽管这是我已经半工作的方法)
  • Sharepoint Web服务
  • 客户端对象模型
  • HTTP put
  • Webclient写入流

我已经看到了很多不同的例子人们在做完全不同的事情,但似乎都不起作用,而且似乎都是“旧”的做事方式。我在 IIS 7 上使用 silverlight 4、sharepoint 2010。是否有上传大型(例如 20-30 meg)文件的最佳实践?我只想将文件转储到文档库中。

I have tried what seems like about a dozen different methods of uploading files to sharepoint from a silverlight application. They either have severe limitations (file size limits of less than a meg or so) or lots of security issues that I have not been able to over come. I have tried:

  • WCF (We are trying not to use any custom WCF services at all FYI though this is the method that I have gotten to semi work)
  • Sharepoint Web services
  • Client object model
  • HTTP put
  • Webclient write stream

I have seen lots of different examples out there of people doing completely different things but none seem to work and all seem like they are the "old" way of doing things. I am using silverlight 4, sharepoint 2010 on IIS 7. Is there a best practice for uploading large (say 20-30 meg) files? I just want to dump a file into a document library.

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

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

发布评论

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

评论(3

诗酒趁年少 2024-10-11 10:39:04

我有类似的问题。从中央管理调整 Web 应用程序级别设置、更改 web.confit 中的 ASP.NET 限制以及以下文章对我有所帮助。

http://blogs.msdn.com/b/sridhara/archive/2010/03/12/uploading-files-using-client-object-model-in-sharepoint-2010.aspx

I had similar issue. Tweaking web application level setting from central admin, changing asp.net limit in web.confit and following article helped me.

http://blogs.msdn.com/b/sridhara/archive/2010/03/12/uploading-files-using-client-object-model-in-sharepoint-2010.aspx

迷迭香的记忆 2024-10-11 10:39:04

只是想到 silverlight 有一个叫做 HTML Bridge 的东西,它允许它与页面的其余部分进行交互。考虑从 Silverlight 调用 javascript 函数,并让 javascript 函数执行实际的上传

更新 - Javascript ClientOM 似乎没有 SaveBinaryDirect 方法:-(
如何执行一些 ExecuteQueryAsync,然后在成功回调函数中(不再在 UI 线程上)使用 Microsoft.SharePoint.Client 版本的 File?我知道这需要下载更大的程序集,所以也许这不太好。

我想知道是否有一种方法可以让 clientOM 在调用 Web 服务时使用更有效的绑定......

Martin

Just had a thought silverlight has a thing called an HTML Bridge which allows it to interact with the rest of the page. Consider calling a javascript function from Silverlight, and let the javascript function do the actual upload

UPDATE - the Javascript ClientOM doesn't seem to have the SaveBinaryDirect method :-(
How about doing some ExecuteQueryAsync and then in the success call back function (no longer on the UI thread), using the Microsoft.SharePoint.Client version of File? I know this would require downloading the larger assembly, so perhaps that's not so good.

I wonder if there is a way to get the clientOM use a more efficient binding when calling the web services...

Martin

戈亓 2024-10-11 10:39:04

SharePoint 客户端对象模型的默认上传大小限制为 2 MB。您可以通过修改服务的 MaxReceivedMessageSize 属性来更改该限制。

这可以通过两种方式完成:

  • 以编程方式 - 如此中所述链接 - 不过这在 Silverlight 中不起作用

    例如以

  • 通过 powershell。在安装了 SharePoint 的服务器上,启动 SharePoint Management Shell(确保在场管理员帐户下运行它)并运行以下命令。

    $ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    $ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 52428800

    $ws.Update()

这会将上传限制更改为 52428800 字节 - 或 50 MB。现在,重新启动托管 SharePoint 网站(或整个 IIS)的网站以使更改生效。

The default upload size limit for the SharePoint client object model is 2 MB. You can change that limit by modifying the MaxReceivedMessageSize property of the service.

This can be done in two ways:

  • programatically - as described in this link - tho this won't work in Silverlight for example

  • trough the powershell. On the server where you have SharePoint installed, fire up the SharePoint Management Shell (make sure you run it under the farm administrator account) and run the following commands.

    $ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    $ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 52428800

    $ws.Update()

This will change the upload limit to 52428800 bytes - or 50 MB. Now, restart the website hosting your SharePoint site (or the entire IIS) for the changes to take effect.

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