I call WCF services, so I hope this is a simple question. When calling a web service with the winform.NET 4 client, how do I change the authorization scheme from anonymous to NTLM?
Now I get an exception: An HTTP request is unauthorized using the Anonymous client authentication scheme. The authentication header received from the server was "NTLM".
My goal is to create a small tool that helps me control the data warehouse and TFS 2010 cube. TFS provides the WarehouseControlWebService web service. I can call the service through test mode in the browser when I enter the server. However, I am trying to call the same web service remotely from my desktop. My user account is in the local administrators group on the server.
I created a .NET 4 WinForm with the canonical Button1 and TextArea1. Then I added a service link to the web service and creatively named it ServiceReference1:
Add Service Reference... http://tfssvr:8080/tfs/TeamFoundation/Administration/v3.0/WarehouseControlService.asmx
And here is my code behind:
private void button1_Click(object sender, EventArgs e) {
I get a System.ServiceModel.Security.MessageSecurityException:
The HTTP request is not authorized using the Anonymous client authentication scheme. The authentication header received from the server was "NTLM".
I tried passing my credentials via:
dwSvc.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("user", "pass", "domain");
and...
dwSvc.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
I make my way through the WCF documentation, but ... oh boy ... there are many. I hope this is something simple.
Thanks in advance.
pappadog
source share