Hi
I can’t connect to my wfc, it is under SSL, but this is not a problem and I use custom authentication… and here starts my problems.
I connect to wfc:
ServiceReference1.Service1Client g = new ServiceReference1.Service1Client();
g.ClientCredentials.UserName.UserName = "a";
g.ClientCredentials.UserName.UserName = "b";
string a = g.GetData(77);
here my exception
System.ServiceModel.ServiceActivationException
WFC’s web.config is
<system.serviceModel>
<services>
<service name="WcfService1.Service1">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="WcfService1.IService1"/>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="WcfService1.UsernameAuthentication, WcfService1" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Class UsernameAuthentication is:
namespace WcfService1
{
public class UsernameAuthentication : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
var ok = (userName == "a") && (password == "b");
ok = true;
if (ok == false)
throw new AuthenticationException(" not match");
}
}
}
My service is
namespace WcfService1
{
[ServiceContract]
public interface IService1
{
[OperationContract]
string GetData(int value);
}
}
can somebody help me?
thanks erika