2
votes

How can I get authorized to use ..._vti_bin/search.asmx ?

I manage to set up a service reference to the above web service.

Anonymous access is disabled on the Sharepoint port 80 site.

Here is my code in VS 2010:

DocSystemApplication.QueryWebServiceProxy.QueryServiceSoapClient client = new DocSystemApplication.QueryWebServiceProxy.QueryServiceSoapClient();

client.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;

string queryXML = @" ....  ";

System.Data.DataSet dataset = client.QueryEx(queryXML);

This gives the runtime exception:

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

A related question is that the examples I find do not seem to use the "QueryServiceSoapClient" but just "QueryService" ?

Any suggestions would be appreciated. // Lars S

1
Similar question and answer: stackoverflow.com/questions/2608887/… - Kit Menke
QueryService - that appears to be the SharePoint 2007 approach... whereas QueryServiceSoapClient is the SharePoint 2010 approach. - Eric Burdo

1 Answers

2
votes

I found the answer myself.

In the app.config there is a section security mode="None", and on next line... transport clientCredentialType="None" proxyCredentialType="None" realm=""

I changed this to mode="TransportCredentialOnly" and ...clientCredentialType="Ntlm" proxyCredentialType="Ntlm" realm=""

and it started working!

We found this suggestion here.