I've written a simple Application that utilizes WCF to communicate between client and server. When I run it locally it works fine, however when I run the server and client on two different boxes I get the following exception:
Unexpected error occured, while getting the group names from the VDN server
System.ServiceModel.Security.SecurityNegotiationException: The server has rejected the client credentials.
System.Security.Authentication.InvalidCredentialException: The server has rejected the client credentials.
System.ComponentModel.Win32Exception: The logon attempt failed
What are the credentials that are not being accepted? And how can I set them?
Is there a way to configure the server to not require authentication? The application is a simple monitoring app to security is not really an issue.
Sorry about not being very specific: The app uses a pipe proxy and there is no wcf config file as the wcf code is hand coded.
My WCF code is based on the code in this tutorial: http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication
I didn't konw it was standard proctice to generate the wcf classes from a config till after I'd finished writing all the code. Now whenever I look at a tutorial/ help doc they use generated code and everything requires changing the config.
I don't have the bandwidth (I'm juggling 3 projects already) to replace my wcf component with one tht uses generated code but I will make sure to use the code generation next time I use wcf.
To configure a service to authenticate its clients using Windows Domain username and passwords use the WSHttpBinding and set its Security. Mode property to Message . In addition you must specify an X509 certificate that will be used to encrypt the username and password as they are sent from the client to the service.
Here's a solution I found in a search for disabling wcf security/authentication.
From MSDN:
WSHttpBinding b = new WSHttpBinding();
b.Security.Mode = SecurityMode.None;
or add the following in config:
<wsHttpBinding>
<binding name="myBinding">
<security mode="None" />
</binding>
</wsHttpBinding>
Create a method like this...
void SetImpersonation(ref IServiceClient proxy)
{
proxy.ClientCredentials.Windows.ClientCredential.Domain = "MYDOMAIN";
proxy.ClientCredentials.Windows.ClientCredential.UserName = "A_USER";
proxy.ClientCredentials.Windows.ClientCredential.Password = "P4SSW0RD";
}
and call it when you create the new client class.
IServiceClient proxy = new IServiceClient ();
SetImpersonation(ref proxy);
Obvously, this is setting the information to be a specific user, and has security implications if your code is decompiled, but it should work in your (config file-less scenario)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With