English 中文(简体)
SharePoint : web service permission error
原标题:

I have a sharepoint site, and I am calling a standard sharepoint web service.

I create the web service request like this :

wsDws.Url = this.SiteAddress + @"/_vti_bin/Dws.asmx";

When I use localhost as hostname it works, but when I use machine name I get an error 401 Unauthorized.

I am setting the credentials like this:

    NetworkCredential NC;
    if (string.IsNullOrEmpty(this.Domain))
    {
        NC = new NetworkCredential(this.Username, this.Password);
    }
    else
    {
        NC = new NetworkCredential(this.Username, this.Password, this.Domain);
    }


    //Lists
    wsLists.Timeout = -1;
    wsLists.Credentials = NC;

    //Dws
    wsDws.Timeout = -1;
    wsDws.Credentials = NC;

Any ideas how I can fix this?

问题回答

You need to change some settings in your registry to make it work. Quite annoying I know, but it does the trick: http://koenvosters.wordpress.com/2009/06/15/access-denied-when-using-hostname-search-and-site-on-moss-2007/

This is probably the infamous DisableLoopBackCheck problem. Get the solution and the reason here.





相关问题
IIS 6.0 hangs when serving a web-service

I am having issues with one of our web-services. It works fine on my development machine (win XP) whether I host it as a separate application or using cassini from Visual studio. Once I deploy on the ...

ASP.net web services

I am using a web service which sets the Thread.CurrentPrincipal object while logging in and soon later when another webmethod of the same web service accesses Thread.CurrentPrincipal, its different/...

Unity Container Disposing and XML Web Service

I am registering some wrapers over un-managed objects in container. How can I dispose of them at the end of the container s lifetime? Please bear in mind I have an XML Web service.

SharePoint : web service permission error

I have a sharepoint site, and I am calling a standard sharepoint web service. I create the web service request like this : wsDws.Url = this.SiteAddress + @"/_vti_bin/Dws.asmx"; When I use ...

热门标签