tags:

views:

2422

answers:

4

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.

+7  A: 

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>
mirezus
A: 

We need more info to see what's happening:

  • What binding are you using?
  • What do your server and client config files look like?

Marc

marc_s
+4  A: 

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)

ZombieSheep
I can migrate those values into the app.config. I just don't have a config file for the wcf code.Thanks though that looks good.
Omar Kooheji