CSOM Sharepoint-在Mono上运行时无法调用File.OpenBinaryDirect [英] CSOM Sharepoint - Cannot call File.OpenBinaryDirect when running on Mono

查看:116
本文介绍了CSOM Sharepoint-在Mono上运行时无法调用File.OpenBinaryDirect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此程序将共享点站点导出到文件: https://github.com/nddipiazza/Sharepoint-Exporter/blob/master/SpCrawler/SpPrefetchIndexBuilder.cs

I am using this program to export a sharepoint site to file: https://github.com/nddipiazza/Sharepoint-Exporter/blob/master/SpCrawler/SpPrefetchIndexBuilder.cs

在Windows上运行时,效果很好.

This works great when run on windows.

当我使用Mono构建它并在Linux上运行时,出现文件下载冻结的问题:

When I build it using Mono and run it on Linux I get an issue where the file download freezes up:

public void DownloadFilesFromQueue() { Console.WriteLine("Starting Thread {0}", Thread.CurrentThread.ManagedThreadId); FileToDownload toDownload; while (fileDownloadBlockingCollection.TryTake(out toDownload)) { try { ClientContext clientContext = getClientContext(toDownload.site); var fileInfo = File.OpenBinaryDirect(clientContext, toDownload.serverRelativeUrl);

//在此处冻结 使用(var fileStream = System.IO.File.Create(toDownload.saveToPath)) { Console.WriteLine(线程{0}-将{1}保存到{2}",Thread.CurrentThread.ManagedThreadId,toDownload.serverRelativeUrl,toDownload.saveToPath); fileInfo.Stream.CopyTo(fileStream); } } catch(异常e) { Console.WriteLine(尝试下载文件{0}时出错:{1}",toDownload.saveToPath,e.Message); Console.WriteLine(e.StackTrace); } } }

// FREEZES HERE using (var fileStream = System.IO.File.Create(toDownload.saveToPath)) { Console.WriteLine("Thread {0} - Saving {1} to {2}", Thread.CurrentThread.ManagedThreadId, toDownload.serverRelativeUrl, toDownload.saveToPath); fileInfo.Stream.CopyTo(fileStream); } } catch (Exception e) { Console.WriteLine("Got error trying to download file {0}: {1}", toDownload.saveToPath, e.Message); Console.WriteLine(e.StackTrace); } } }

是否有某种方法可以在Mono上完成这项工作?该程序的其余部分工作正常!

Is there some way to make this work on Mono? The rest of the program works fine!

切换到下载文件的HttpClient形式可以正常工作.所以我想这段代码不是与操作系统无关的.我如何为此创建票证?

Switching to a HttpClient form of downloading the file works fine. So I guess this code is not OS independent. How can I create a ticket for this?

推荐答案

您是说它挂在使用 ( fileStream . . . 创建 ( . saveToPath

do you mean it hungs at using (var fileStream = System.IO.File.Create(toDownload.saveToPath))?


这篇关于CSOM Sharepoint-在Mono上运行时无法调用File.OpenBinaryDirect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆