我是一名.NET Web应用程序的开发者。我正在尝试使用HTTPClient和Sharepoint 2013 REST API连接到Sharepoint Online Premise,以获取“文档库”中的文档。
我在浏览器中测试了以下REST服务。
我遇到了以下异常: "The request was aborted: Could not create SSL/TLS secure channel." 堆栈跟踪如下:
我已经阅读了各种关于此问题的文章/博客,但都没有找到解决方案。我看到了一些使用{{authentication method}}进行身份验证的示例。
我在浏览器中测试了以下REST服务。
https://site_url/_vti_bin/ListData.svc/Documents
这个功能可以提供特定网站文档库中所有文档的元数据。
现在,当我尝试通过添加到服务URL的引用并使用以下代码进行编程时,
TestSiteDataContext ctx = new TestSiteDataContext(new Uri("https://site url/_vti_bin/ListData.svc"));
ctx.Credentials = new NetworkCredential("test@test.onmicrosoft.com", "test");
var data = ctx.Documents.ToList();
我遇到了以下异常: "The request was aborted: Could not create SSL/TLS secure channel." 堆栈跟踪如下:
at System.Net.HttpWebRequest.GetResponse()
at System.Data.Services.Client.QueryResult.Execute()
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
at System.Data.Services.Client.DataServiceQuery`1.Execute()
at System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at SPO_AccessAWebService.Program.Main(String[] args) in Location\Program.cs:line 35
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
我已经阅读了各种关于此问题的文章/博客,但都没有找到解决方案。我看到了一些使用{{authentication method}}进行身份验证的示例。
ctx.Credentials = CredentialCache.DefaultNetworkCredentials;
这也会抛出相同的错误。
还有其他方法可以认证SharePoint 2013 REST API吗?
有人能提供一些解决此问题的见解吗?