无法使用客户端上下文(csom)访问其他服务器场中的列表。远程服务器返回错误:(401)未经授权。 [英] Unable to access a list in a different farm using client context(csom). the remote server returned an error: (401) unauthorized.
问题描述
我正在尝试使用CSOM访问不同服务器场的网站集中的列表。但我收到错误远程服务器返回错误:(401)未经授权。我使用的代码如下。
使用(ClientContext ctx = new ClientContext(URL))
{
Web web = ctx.Site.RootWeb;
ctx.Load(web);
ctx.ExecuteQuery();
Console.Write( web.Title);
}
始终收到身份验证错误。农场之间是否需要特殊的混淆?请帮忙。提前致谢。
我尝试了什么:
我尝试过这些步骤
ctx.Credentials = CredentialCache.DefaultNetworkCredentials;
ctx.Credentials = new NetworkCredential(用户名,密码,域名);
但没用。仍然得到同样的错误。在web.config或任何地方有什么要改变的吗?我尝试使用NTLM webapps和kerbos身份验证。没有区别。
I am trying to access a list in a site collection of different farm using CSOM. But I am getting the error "The remote server returned an error: (401) Unauthorized." Code I used is below.
using (ClientContext ctx = new ClientContext(URL))
{
Web web = ctx.Site.RootWeb;
ctx.Load(web);
ctx.ExecuteQuery();
Console.Write(web.Title);
}
Always getting the authentication error. Is any special confoguration required between farms? Please help. Thanks in advance.
What I have tried:
I tried these steps
ctx.Credentials = CredentialCache.DefaultNetworkCredentials;
ctx.Credentials = new NetworkCredential("username", "password", "domain");
But no use. Still getting the same error. Anything to change in web.config or anywhere? I tried using NTLM webapps and kerbos authentications. No difference.
推荐答案
请检查用户是否拥有特定网站/网站集的权限。
Pls check whether the user have permission for the particular site/site collection.
这篇关于无法使用客户端上下文(csom)访问其他服务器场中的列表。远程服务器返回错误:(401)未经授权。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!