WCF 程序在一台服务器上的行为很奇怪 - 为什么? [英] WCF program behaves strangely on one server - why?

查看:34
本文介绍了WCF 程序在一台服务器上的行为很奇怪 - 为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的共享点获取列表方法(SharePointList 是对 list.asmx 的网络引用).

I have a simple get list method for sharepoint (SharePointList is a webrefrence to list.asmx).

    /// <summary>
    /// Returns a list of sharepoint lists
    /// </summary>
    /// <returns>A list of sharepoint lists</returns>
    private string GetSharePointLists()
    {     
        StringBuilder stringBuilder = new StringBuilder();
        try
        {

            SharePointList.ListsSoapClient proxy = new SharePointList.ListsSoapClient();
            proxy.ClientCredentials.Windows.ClientCredential = new NetworkCredential();
            XmlElement lists = proxy.GetListCollection();
            var q = from c in lists.ChildNodes.Cast<XmlNode>()
                    select new
                    {
                        DefaultViewUrl = c.Attributes["DefaultViewUrl"].Value,
                        Title = c.Attributes["Title"].Value
                    };

            foreach (var x in q)
            {
                stringBuilder.AppendLine(string.Format("{0} http://REMOVED/{1}", x.Title, x.DefaultViewUrl.Replace(" ", "%20")));
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.ToString());
        }
        return stringBuilder.ToString();
    }

它在我的开发箱上运行良好.它曾经在我的测试机器上也能正常工作.重新构建测试机后,我总是在 proxy.GetListCollection()-

It works fine on my dev box. It used to work fine on my test machine as well. Once the test machine was rebuilt I always get this error on proxy.GetListCollection()-

HTTP 请求未经授权,客户端身份验证方案为Ntlm".从服务器收到的身份验证标头是NTLM".

有人知道这里发生了什么以及如何解决吗?

Anyone know what's going on here and how to fix it?

推荐答案

事实证明 401 访问被拒绝消息只不过是表面上的.该网络服务可在所有其他机器上运行,因为它们都有共享点网络服务的权限.

It turns out the 401 access denied message was nothing more than it seemed. The webservice worked on all other machines because they all had permission to sharepoint webservices.

新重建的服务器连接的用户没有.我将服务器运行的用户添加到具有适当权限的人员和组"中,并且列表运行良好.

The user the newly rebuilt server connected as did not. I added the user the server runs as to the "People and Groups" with the appropriate permissions and the list ran fine.

这篇关于WCF 程序在一台服务器上的行为很奇怪 - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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