I have a service, that principal I would like to be duplex, however, for some operations, I need to use the streamed transfer mode, so I would like to have two contracts, one is the general contract, that let me interact with the database and send messages to the client from the service if I need it, and other contract to interact with files, save and get the files to the database.
I need the two contracts because the tcp binding is not compatible with duplex.
The service is hosted in a WPF application, and the config files is the following:
<system.serviceModel>
<services>
<service name="GTS.CMMS.Service.Service" behaviorConfiguration="behaviorConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:7997/CMMSHost"/>
<add baseAddress="http://localhost:7998/CMMSHost"/>
</baseAddresses>
</host>
<endpoint address="/ServiceCore"
binding="netTcpBinding"
bindingConfiguration="tcpBinding"
name="ServiceCore"
contract="GTS.CMMS.Service.IService">
<!--<identity>
<dns value="localhost" />
</identity>-->
</endpoint>
<endpoint address="/ServiceDocumentos"
binding="netTcpBinding"
bindingConfiguration="tcpBindingDocumentos"
name="ServiceDocumentos"
contract="GTS.CMMS.Service.IServiceDocumentos">
<!--<identity>
<dns value="localhost" />
</identity>-->
</endpoint>
<endpoint contract="IMetadataExchange" binding="mexTcpBinding" address="net.tcp://localhost:5000/mex" />
</service>
</services>
<!--El behavior son datos de configuración del servicio que no forman parte del endpoint.
Por ejemplo, si el servicio da una excepción, se querrá informar al cliente.-->
<behaviors>
<serviceBehaviors>
<behavior name="behaviorConfig">
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<!--Necesario para poder mandar excepciones desde el servicio hasta el cliente.-->
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" />
</behavior>
<behavior name="behaviorConfigDocumentos">
<!--<serviceMetadata httpGetEnabled="true" />-->
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<!--Necesario para poder mandar excepciones desde el servicio hasta el cliente.-->
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" />
<serviceMetadata/>
</behavior>
</serviceBehaviors>
</behaviors>
<!--Se necesita la configuración del binding para que funcione correctamente la comunicación entre el cliente y el servidor.-->
<bindings>
<netTcpBinding>
<!--Se configura el binding que se utilizará para el endPoint ChatServiceAssembly.IChat-->
<binding name="tcpBinding" maxBufferSize="67108864"
maxReceivedMessageSize="67108864" maxBufferPoolSize="67108864"
transferMode="Buffered" closeTimeout="00:00:10"
openTimeout="00:00:10" receiveTimeout="00:20:00"
sendTimeout="00:01:00" maxConnections="100">
<security mode="None"/>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<reliableSession enabled="true" inactivityTimeout="00:20:00" />
</binding>
<binding name="tcpBindingDocumentos" maxBufferSize="67108864"
maxReceivedMessageSize="67108864" maxBufferPoolSize="67108864"
transferMode="Streamed" closeTimeout="00:00:10"
openTimeout="00:00:10" receiveTimeout="00:20:00"
sendTimeout="00:01:00" maxConnections="100">
<security mode="None"/>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<reliableSession enabled="true" inactivityTimeout="00:20:00" />
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
To check if all works, I go to the internet explorer and go to:
http://localhost:7998/CMMSHost
If I have the two endpoints, the page is not found, but if I comment the second endpoint, the "/ServiceDocumentos" the page is found and I can use svcutil to create the proxy.
How could I configure many endpoints?
Thanks.
Related
I'm having the following error:
System.IdentityModel.Tokens.SecurityTokenValidationException
The X.509 certificate CN=RootCA chain building failed. The
certificate that was used has a trust chain that cannot be verified.
Replace the certificate or change the certificateValidationMode. A
certificate chain processed, but terminated in a root certificate
which is not trusted by the trust.
The certificate I'm using is the one that you can create following this tutorial: How to: Create Temporary Certificates for Use During Development specifically the "RootCA" certificate.
I have genuinely no idea how to solve it. The things I have already tried:
Setting certificateValidationMode to "None", setting revocationMode
to "NoCheck"
Creating a certificate that has as "parent" the certificate I'm
using right now and trying with it (as in the example there is in the previous link)
Importing the certificate to Trusted People and Entrusted Root
folders
Setting storeName to "TrustedPeople" in the "serviceCertificate"
node and trustedStoreLocation to "LocalMachine" in the
"authentication" node -along with the point 3-
Using CurrentUser as storeLocation
My current code is (I need to hide the name of my files for privacy):
Client
<bindings>
<basicHttpBinding>
<binding name="basicHttpEndpointBinding">
<security mode="Message">
<message clientCredentialType="Certificate"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:51845/XXXXX.svc" behaviorConfiguration="BCertificado"
binding="basicHttpBinding" bindingConfiguration="basicHttpEndpointBinding"
contract="XXXXXF1Service.IXXXXXF1Service" name="basicHttpEndpoint">
<identity>
<certificate encodedValue="Huge string" />
</identity>
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="BCertificado">
<clientCredentials>
<clientCertificate findValue="RootCA" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
Server
<bindings>
<basicHttpBinding>
<binding name="basicHttpEndpointBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Message">
<message clientCredentialType="Certificate"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="service1">
<endpoint address="XXXXXServices" binding="basicHttpBinding" bindingConfiguration="basicHttpEndpointBinding"
name="basicHttpEndpoint" contract="IXXXXF1Service" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- Para evitar revelar información de los metadatos, establezca los valores siguientes en false antes de la implementación -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<!-- Para recibir detalles de las excepciones en los errores para la depuración, establezca el siguiente valor en true. Para no revelar información sobre las excepciones establézcalo en false antes de la implementación -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="ServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceCredentials>
<serviceCertificate findValue="RootCA" x509FindType="FindBySubjectName" storeLocation="LocalMachine"/>
<clientCertificate>
<authentication certificateValidationMode="None" revocationMode="NoCheck"/>
</clientCertificate>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpBinding" scheme="http" />
</protocolMapping>
Any other advice related to those files is also appreciated since I dont know what I'm doing to be honest. Thank you so much in advance.
Try adding the endpoint behavior in your client application and set the behavior configuration you added in the endpoint.
<behaviors>
<endpointBehaviors>
<behavior name="BCertificado">
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="None" revocationMode="NoCheck"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
I've referred to several stackoverflow threads on the above matter, but even after applying the solutions mentioned, I still get the same error.
I adjusted the settings as per this and this, so my web.config in the client and app.config in the WCF service look as follows:
web.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding maxReceivedMessageSize="10485760" name="WSHttpBinding_IMessengerService">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors >
<endpointBehaviors>
<behavior name="WSHttpBinding_IMessengerService">
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost:8005/MessengerService/Service" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMessengerService" contract="MessengerService.IMessengerService">
<identity>
<servicePrincipalName value="Local Network" />
</identity>
</endpoint>
</client>
</system.serviceModel>
App.config:
<system.serviceModel>
<services>
<!-- This section is optional with the new configuration model introduced in .NET Framework 4. -->
<service name="Omnix.Messenger.Service.MessengerService" behaviorConfiguration="MessengerServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8005/MessengerService/Service" />
</baseAddresses>
</host>
<!-- this endpoint is exposed at the base address provided by host: http://localhost:8005/MessengerService/service -->
<endpoint address="" binding="wsHttpBinding" contract="Omnix.Messenger.Service.Contract.IMessengerService" />
<!-- the mex endpoint is exposed at http://localhost:8005/MessengerService/service/mex -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MessengerServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
Can someone please point out what I'm doing wrong, and how to resolve the issue?
You also need to set the same configuration on server side.
In your app.config add the binding configuration:
<system.serviceModel>
<!-- add the lines below -->
<bindings>
<wsHttpBinding>
<binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" name="WSHttpBinding_IMessengerService">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
Also change Web.config:
<binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" name="WSHttpBinding_IMessengerService">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
Hope it helps
I have 2 WCF services.
Service 1 hosted as HTTPS. Service 1 calls service 2 (which is http only).
binding used : basicHtpBinding
it throws error as "The provided URI scheme 'http' is invalid; expected 'https'."
Update :
Code where i am calling Service 2 from Service 1 :
public bool CreateMethod(string message)
{
return Client.AnotherMethod(message);
}
Service 1 Config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IObject" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://XX.xx.xx.xx:8001/Services.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IObject"
contract="AppService.IObject" name="BasicHttpBinding_IObject" />
</client>
<services>
<service behaviorConfiguration="ServiceBehaviour" name="WebService.IntegrationService">
<endpoint address="" binding="basicHttpBinding" `enter code here`contract="WebService.IIntegrationService" bindingConfiguration="BasicHttpBinding_IObject" behaviorConfiguration="basicHttp"></endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="basicHttp">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>`
</configuration>
Service 2 Config :
<system.serviceModel>
<services>
<service name="MY.Service">
<endpoint address="" binding="basicHttpBinding" contract="App.IObject">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
I have a problem with my wcf service.
I have read all posts about this error, i tried almost all propsitions but it does not works!!
I want to upload images smaller than 1 mb.
My client config by code :
EndpointAddress ea = new EndpointAddress("AddressofServer");
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
XmlDictionaryReaderQuotas reader = new XmlDictionaryReaderQuotas();
basicHttpBinding.MaxBufferSize = 2147483647;
basicHttpBinding.MaxBufferPoolSize = 2147483647;
basicHttpBinding.MaxReceivedMessageSize = 2147483647;
reader.MaxStringContentLength = 2147483647;
reader.MaxDepth = 2147483647;
reader.MaxArrayLength = 2147483647;
reader.MaxBytesPerRead = 2147483647;
reader.MaxNameTableCharCount = 2147483647;
basicHttpBinding.ReaderQuotas = reader;
basicHttpBinding.SendTimeout = new TimeSpan(0, 0, 50);
basicHttpBinding.OpenTimeout = new TimeSpan(0, 0, 5);
basicHttpBinding.ReceiveTimeout = basicHttpBinding.SendTimeout;
basicHttpBinding.AllowCookies = false;
basicHttpBinding.Security.Mode = BasicHttpSecurityMode.None;
ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client(basicHttpBinding, ea);
string nm = sc.Endpoint.Binding.Name;
using (FileStream fs = new FileStream("c:\\httpfiles\\test.jpg", FileMode.Open))
{
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
sc.GetImage(1, "appareillage", buffer);
}
My web.config file :
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="bnd"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647" closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" messageEncoding="Text">
<readerQuotas
maxArrayLength="2147483647"
maxStringContentLength="2147483647" />
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment
multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />
<services>
<service name="PodoTouchService.PTouchService" behaviorConfiguration="" >
<endpoint address="mex" binding="basicHttpBinding" bindingConfiguration="bnd"
contract="Service1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true">
<requestLimits maxAllowedContentLength="2147483647"/>
<fileExtensions allowUnlisted="true"/>
<verbs allowUnlisted="true"/>
</requestFiltering>
</security>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
I tried to change applicationHost.config too.
Any idea ?
Thanks for the reply, i found the problem.
When i have created the service i changed the ServiceContract attribute to
[ServiceContract(Namespace="PTouchService")]
public interface IService1
And in the web config file i could not matched this name space. And as a result all changes that i tried did not work.
This is the working version of my web config file:
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PTouchService.Service1Behavior">
<!-- Pour éviter la divulgation d'informations de métadonnées, définissez la valeur ci-dessous sur false avant le déploiement -->
<serviceMetadata httpGetEnabled="true"/>
<!-- Pour recevoir les détails de l'exception dans les erreurs à des fins de débogage, définissez la valeur ci-dessous sur true. Pour éviter la divulgation d'informations d'exception, définissez-la sur false avant le déploiement -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="bnd" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
I'm working on a WCF Service, sincerely I am new to WCF, and I'm stuck pretending to do a service with Message Security, self-hosted and using wsHttpBinding.
I get the next exception:
System.ServiceModel.Security.SecurityNegotiationException: Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint. ---> System.ServiceModel.FaultException: The request for security token has invalid or malformed elements.
And this is the configuration file on server side:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<sources>
<!-- En esta seccin se define la configuracin del registro para My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog" />
<!-- Quite los comentarios de la seccin posterior para escribir en el registro de eventos de la aplicacin -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter" />
<!-- Quite los comentarios de la seccin posterior y reemplace APPLICATION_NAME con el nombre de su aplicacin para escribir en el registro de eventos de la aplicacin -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpointBinding">
<security>
<message clientCredentialType="Certificate" />
</security>
</binding>
<binding name="wsBehavior" 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">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<message clientCredentialType="Certificate" negotiateServiceCredential="true" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="WCFServiceCertificate.Service1" behaviorConfiguration="WCFServiceCertificate.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="http://localhost/RHCloud.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding"
contract="WCFServiceCertificate.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<client><!--risq.dyndns.biz-->
<endpoint address="http://localhost/RHCloud.svc/A" binding="wsHttpBehavior"
bindingConfiguration="wsBehavior" contract="ServicioRH.IAvisos"
name="ServiceAvisos" behaviorConfiguration="CustomBehavior">
<identity>
<dns value="WCFServer" />
</identity>
</endpoint>
<endpoint address="http://localhost/RHCloud.svc/P" binding="wsHttpBehavior"
bindingConfiguration="wsBehavior" contract="ServicioRH.IPersonal"
name="Servicepersonal" behaviorConfiguration="CustomBehavior">
<identity>
<dns value="WCFServer" />
</identity>
</endpoint>
</client>
<behaviors>
<serviceBehaviors>
<behavior name="WCFServiceCertificate.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="PeerTrust" />
</clientCertificate>
<serviceCertificate findValue="WCFServer"
storeLocation="CurrentUser"
storeName="My"
x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="CustomBehavior">
<clientCredentials>
<clientCertificate findValue="WCFClient" x509FindType="FindBySubjectName" storeLocation="CurrentUser"
storeName="My" />
<serviceCertificate>
<authentication certificateValidationMode="PeerTrust" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>