WebException未处理 [英] WebException was unhandled

查看:85
本文介绍了WebException未处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的CSOM代码中,ClientContentSource.ExecuteQuery()触发了webexeption.它说远程服务器返回了未找到的错误(404).我正在尝试通过此代码连接到SharePoint 2010网站.任何人都可以提供输入/帮助来解决此问题.

Hi, In my CSOM code,ClientContentSource.ExecuteQuery() is triggering webexeption. It says the remote server returned an error (404) not found. I'm trying to connect to SharePoint 2010 site though this code. Could anyone provide input/help to resolve this.

推荐答案

请确保网站网址正确,并检查以下代码:

Please make sure the site url is right, and check the code below:

using (ClientContext context = new ClientContext("http://yourserver/")) {
    context.Credentials = new NetworkCredential("user", "password", "domain");
    List list = context.Web.Lists.GetByTitle("Some List");
    context.Load(list);
    context.ExecuteQuery();
    //do something
}

我建议您在可能的情况下提供完整的代码,这应该使问题更易于研究.

I suggest you provide the complete code in use if possible, which should make the issue easier to be researched.

最好的问候,

丹尼斯


这篇关于WebException未处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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