Welcome to the RaGEZONE - MMORPG development forums.

[C#] WCF + UserName validation

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 ...

Results 1 to 1 of 1
  1. #1
    Fuck.
    Rank
    Moderator
    Join Date
    Feb 2008
    Location
    Jaú, Brazil
    Posts
    2,195
    Liked
    610
    Gamertag: Borgo01

    [C#] WCF + UserName validation

    Click
    I'm trying for a few days to add username validation in my WCF service. The class starting the server:

    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 
    = 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();
            } 
    but when I try to run, an error occurs:

    The ChannelDispatcher at 'net.tcp://127.0.0.1/MasterServer' with contract(s) 'IMasterServer' is unable to open its IChannelListener.
    Validator class:

    PHP Code:
        public class Validator UserNamePasswordValidator
        
    {
            public 
    override void  Validate(string userNamestring password)
            {
                 
            }
        } 
    no codes because I couldnt fix the error yet =/

    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.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •