I am trying to implement message security in my wcf application and I am getting some error
"The caller was not authenticated by service" here is my Service Host code
WSHttpBinding obHttpBinding = new WSHttpBinding();
obHttpBinding.Security.Mode = SecurityMode.Message;
obHttpBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate;
obHost = new ServiceHost(typeof(IserviceDescription), new Uri[] { new Uri("http://localhost:8000"), new Uri("net.tcp://localhost:9000") });
obHost.AddServiceEndpoint(typeof(IService), obHttpBinding, "");
obHost.Credentials.ServiceCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectName, "TestCert");
obHost.Open();
Client Web Config
<?xmlversion=
"1.0 "encoding= "utf-8 " ?>
<configuration>
<
system.serviceModel
>
<
behaviors
>
<
endpointBehaviors
>
<
behaviorname=
"NewBehavior ">
<
clientCredentials
>
<
clientCertificatefindValue=
"TestCert "storeLocation= "LocalMachine "storeName= "My "x509FindType= "FindBySubjectName " />
<
serviceCertificate
>
<
authenticationcertificateValidationMode=
"ChainTrust "revocationMode= "NoCheck "/>
</
serviceCertificate
>
</
clientCredentials
>
</
behavior
>
</
endpointBehaviors
>
</
behaviors
>
<
bindings
>
<
wsHttpBinding
>
<
bindingname=
"WSHttpBinding_IService "closeTimeout= "00:01:00 "
openTimeout=
"00:01:00 "receiveTimeout= "00:10:00 "sendTimeout= "00:01:00 "
bypassProxyOnLocal=
"false "transactionFlow= "false "hostNameComparisonMode
= "StrongWildcard "
maxBufferPoolSize=
"524288 "maxReceivedMessageSize= "65536 "
messageEncoding=
"Text "textEncoding= "utf-8 "useDefaultWebProxy
= "true "
allowCookies=
"false ">
<
readerQuotasmaxDepth=
"32 "maxStringContentLength= "8192 "maxArrayLength= "16384 "
maxBytesPerRead=
"4096 "maxNameTableCharCount= "16384 " />
<
reliableSessionordered=
"true "inactivityTimeout= "00:10:00 "
enabled=
"false " />
<
securitymode=
"Message ">
<
transportclientCredentialType=
"Windows "proxyCredentialType= "None "
realm=
"" />
<
messageclientCredentialType=
"Certificate "negotiateServiceCredential
= "true "
algorithmSuite=
"Default "establishSecurityContext
= "true " />
</
security
>
</
binding
>
</
wsHttpBinding
>
</
bindings
>
<
client
>
<
endpointaddress=
"http://192.168.1.6:8000/ "behaviorConfiguration
= "NewBehavior "
binding=
"wsHttpBinding "bindingConfiguration
= "WSHttpBinding_IService "
contract=
"ServiceReference1.IService "name= "WSHttpBinding_IService ">
<identity>
<
certificateencodedValue=
"AwAAAAEAAAAU…/>
</
identity
>
</
endpoint
>
I have tried to search a lot about this type of error but unable to get any reliable information please suggest where I am wrong in this.