Not able to run WCF service RRS feed

  • Question

  • User1778555483 posted

    I tried to implement UserNamePasswordValidator, after doing this i m getting exception, not able to figure it out. below are the details , please help.

    namespace WCFSecurity
        public interface IService1
            string GetData();
    using System.IdentityModel.Selectors;
    using System.IdentityModel.Tokens;
    namespace WCFSecurity
        public class Service1 : IService1
            public string GetData()
                return string.Format("Hello World");
        public class CustomValidator : UserNamePasswordValidator
    	        public override void Validate(string userName, string password)
    	            if (userName == "test" && password == "test")
    	            throw new SecurityTokenException(
    	                "Unknown Username or Password");
          <service name="WCFSecurity.Service1" behaviorConfiguration="myBehaviour">
            <endpoint address="" binding="wsHttpBinding" contract="WCFSecurity.Service1" bindingConfiguration="SafeServiceConf"/>
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
    				<behavior name="myBehaviour">
    					<serviceMetadata httpGetEnabled="true"/>
    					<serviceDebug includeExceptionDetailInFaults="false"/>
    		<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
            <binding name="SafeServiceConf" maxReceivedMessageSize="65536">
              <readerQuotas maxStringContentLength="65536" maxArrayLength="65536"
              maxBytesPerRead="65536" />
              <security mode="TransportWithMessageCredential">
                <message clientCredentialType="UserName" />

    Getting this Exception

    Server Error in '/WCFSecurity' Application.

    Could not load type 'WCFSecurity.CustomValidator' from assembly 'WCFSecurity'

    Saturday, January 26, 2013 1:22 AM


  • User-1000095884 posted


    Could not load type 'WCFSecurity.CustomValidator' from assembly 'WCFSecurity'

    The issue may located at "customUserNamePasswordValidatorType="WCFSecurity.CustomValidator,WCFSecurity" ", please check the location of the class, the first part is the class name fully qualified by the namespace, the second is the assembly the class is in.

    Best Regards.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 28, 2013 2:15 AM