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.QueryWebServ开发者_JS百科iceProxy.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
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.
精彩评论