This is a discussion on [C#] WCF + UserName validation within the Coders' Paradise forums, part of the Evolution : RaGEZONE category; I'm trying for a few days to add username validation in my WCF service. The class starting the server: PHP ...
I'm trying for a few days to add username validation in my WCF service. The class starting the server:
but when I try to run, an error occurs:PHP Code:public static void Run(System.Net.IPAddress IP)
{
var host = new ServiceHost(typeof(Pipes), new Uri[] { new Uri("net.tcp://" + IP.ToString()) });
var p = new NetTcpBinding(SecurityMode.Message);
p.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
host.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = System.ServiceModel.Security.UserNamePasswordValidationMode.Custom;
host.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new Validator();
host.AddServiceEndpoint(typeof(IMasterServer), p, "MasterServer");
host.AddServiceEndpoint(typeof(IDatabaseService), p, "DatabaseServer");
host.AddServiceEndpoint(typeof(IChatServer), p, "ChatServer");
host.Open();
}
Validator class:The ChannelDispatcher at 'net.tcp://127.0.0.1/MasterServer' with contract(s) 'IMasterServer' is unable to open its IChannelListener.
no codes because I couldnt fix the error yet =/PHP Code:public class Validator : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
}
}
what am I doing wrong? I already looked tons of articles on msdn, codeproject but either they are very confused using app.config files or they arent exactly what I was looking for...
It says also that I need to specify a service certificate in servicecredentials.. how?
Last edited by SheenBR; 28-04-12 at 10:24 PM.