WCF doesn't find client configuration

Posted by ultraman69 on Stack Overflow See other posts from Stack Overflow or by ultraman69
Published on 2010-05-19T13:07:32Z Indexed on 2010/05/19 13:10 UTC
Read the original article Hit count: 358

Filed under:
|

Hi !

I have a WCF service on server B. Then on the machine A is the client, which is a Windows service. In a separate dll stands all the business logic for this service. So my proxy for the WCF is on that side. I have 2 app.config (client side only) : 1 for the service and another one in the dll. So I tried (for test purpose) puting the servicemodel config section in both. Both still, it doesn't work, it says that it can't find the endpoint with that name and for that contract...

What I'm trying to do here is modify the configuration programatically. Here' the code in the business layer dll :

Dim ep As New EndpointAddress(New Uri(ConfigurationManager.AppSettings(nomServeurCible)), _
                                    EndpointIdentity.CreateDnsIdentity(ConfigurationManager.AppSettings("Identity_" & nomServeurCible)))

    serviceCible = New ServiceProxy.ExecOperClient("wsHttp", ep)

And here is a sample of the config file :

<add key="TEST1" value="http://TEST1:8000/MySpacePerso/ExecOperService"/>
<add key="TEST1_CertificateSerialNumber" value="10 hj 6y 7b 00 01 32 12 01 21"/>
<add key="Identity_TEST1" value="TEST1"/>

<system.serviceModel>
<client>
  <endpoint address="http://SERV_NAME:8000/CSSTQDA/ExecOperService" binding="wsHttpBinding"
            behaviorConfiguration="myClientBehavior"
            bindingConfiguration="MybindingCon" contract="ExecOper.Service.IExecOper" 
            name="wsHttp">
    <identity>
      <dns value="SERV_CERT_NAME"/>
    </identity>
  </endpoint>
</client>
<bindings>
  <wsHttpBinding>
    <binding name="MybindingCon">
      <security mode="Message">
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceTraitementBehavior">
      <serviceMetadata httpGetEnabled="True"/>
      <serviceDebug includeExceptionDetailInFaults="True" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="myClientBehavior">
      <clientCredentials>
        <serviceCertificate>
          <authentication certificateValidationMode="ChainTrust" revocationMode="NoCheck"/>
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors>

© Stack Overflow or respective owner

Related posts about wcf

Related posts about configuration