1

我试图为 SharePoint 2010 Web 服务编写一个代理,以绕过我们用 Ruby 编写的另一组服务的 NTLM 身份验证。我已经开发了它,当我在 Visual Studio 的 asp.net 服务器中调试它时,我能够很好地获取和解析数据。但是,当我将它部署到我们的 IIS 服务器时,我收到以下错误:

"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel"

我正在使用 SharePoint 2010 客户端对象模型来连接到我可以完全控制访问的自签名 Sharepoint 网站。同样,当我调试它时,它工作得非常好,但在 IIS 上,它会通过以下 Stacktrace 抛出该错误:

at System.Net.HttpWebRequest.GetResponse() at
Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() at
Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest() at
Microsoft.SharePoint.Client.ClientContext.ExecuteQuery() at
SharepointProxy.SharepointProxy.GetListData(String listName) in
\\psf\home\documents\visual studio
2010\Projects\SharepointWSProxy\SharepointProxy\SharepointProxy.svc.cs:line 56 at
SharepointProxy.SharepointProxy.GetEmployees() in \\psf\home\documents\visual studio
2010\Projects\SharepointWSProxy\SharepointProxy\SharepointProxy.svc.cs:line 19 at
SyncInvokeGetEmployees(Object , Object[] , Object[] ) at
System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[]
inputs, Object[]& outputs) at
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&
rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean
isOperationContextSet)

这是相关的代码。也许我做错了什么?

ClientContext context = new ClientContext("https://url.to.subsite");
List destList = context.Web.Lists.GetByTitle(listName);
CamlQuery qry = new CamlQuery();
qry.ViewXml = "<Valid Query>";
ListItemCollection items = destList.GetItems(qry);
context.Load(items);
context.Load(destList);
context.ExecuteQuery();

上面的第 56 行是它引用 items 变量的地方。就在这条线的正下方。

有人有想法么?我完全不知道为什么它可以在调试中工作,但不能在 IIS 上工作。

4

0 回答 0