I tried to implement UserNamePasswordValidator, after doing this i m getting exception, not able to figure it out. below are the details , please help.
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.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
ashok.amsama...
Participant
770 Points
158 Posts
Not able to run WCF service
Jan 26, 2013 05:22 AM|LINK
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 { [ServiceContract] public interface IService1 { [OperationContract] 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") return; throw new SecurityTokenException( "Unknown Username or Password"); } } } <system.serviceModel> <services> <service name="WCFSecurity.Service1" behaviorConfiguration="myBehaviour"> <endpoint address="" binding="wsHttpBinding" contract="WCFSecurity.Service1" bindingConfiguration="SafeServiceConf"/> <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="myBehaviour"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> <serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCFSecurity.CustomValidator,WCFSecurity"/> </serviceCredentials> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> <bindings> <wsHttpBinding> <binding name="SafeServiceConf" maxReceivedMessageSize="65536"> <readerQuotas maxStringContentLength="65536" maxArrayLength="65536" maxBytesPerRead="65536" /> <security mode="TransportWithMessageCredential"> <message clientCredentialType="UserName" /> </security> </binding> </wsHttpBinding> </bindings> </system.serviceModel>Getting this Exception
Server Error in '/WCFSecurity' Application.
Could not load type 'WCFSecurity.CustomValidator' from assembly 'WCFSecurity'
Ashok
"MARK AS ANSWER IF MY POST HELPS YOU"
Haixia Xie -...
Contributor
3022 Points
294 Posts
Microsoft
Re: Not able to run WCF service
Jan 28, 2013 06:15 AM|LINK
Hi,
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.
Feedback to us
Develop and promote your apps in Windows Store