Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. WCF: EndpointIdentity problem [modified]

WCF: EndpointIdentity problem [modified]

Scheduled Pinned Locked Moved WCF and WF
wcfcsharpwpfdesignsecurity
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bonkers123
    wrote on last edited by
    #1

    Hi, I created a service with the config file of the client set as follow:

    <system.serviceModel>
    <bindings>
    <netTcpBinding>
    <binding name="ConfigurationManagerTcp" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
    maxReceivedMessageSize="65536">
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <reliableSession ordered="true" inactivityTimeout="00:10:00"
    enabled="true" />
    <security mode="TransportWithMessageCredential">
    <transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign" />
    <message clientCredentialType="UserName" />
    </security>
    </binding>
    </netTcpBinding>
    </bindings>
    <client>
    <endpoint address="net.tcp://localhost:8731/Design_Time_Addresses/WebServiceLibray/TestService/"
    binding="netTcpBinding" bindingConfiguration="ConfigurationManagerTcp"
    contract="WCFTestServiceTcp.ITestService" name="ConfigurationManagerTcp">
    <identity>
    <dns value="CN=bonkers.gendac.co.za" />
    </identity>
    </endpoint>
    </client>
    </system.serviceModel>

    Now, I need to be able to set the EndpointAdress in code, which is simple

    myService.Endpoint.Address = new EndpointAddress(textBox3.Text);

    But, this make the EndpointIdentity NULL... So one can set the EnpointIdentity as follow:

    myService.Endpoint.Address = new EndpointAddress(new Uri(textBox3.Text), epIdentity,
    System.ServiceModel.Channels.AddressHeader.
    CreateAddressHeader("ConfigurationManagerTcp",
    textBox3.Text, 1));

    The ques

    J 1 Reply Last reply
    0
    • B bonkers123

      Hi, I created a service with the config file of the client set as follow:

      <system.serviceModel>
      <bindings>
      <netTcpBinding>
      <binding name="ConfigurationManagerTcp" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
      hostNameComparisonMode="StrongWildcard" listenBacklog="10"
      maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
      maxReceivedMessageSize="65536">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00"
      enabled="true" />
      <security mode="TransportWithMessageCredential">
      <transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign" />
      <message clientCredentialType="UserName" />
      </security>
      </binding>
      </netTcpBinding>
      </bindings>
      <client>
      <endpoint address="net.tcp://localhost:8731/Design_Time_Addresses/WebServiceLibray/TestService/"
      binding="netTcpBinding" bindingConfiguration="ConfigurationManagerTcp"
      contract="WCFTestServiceTcp.ITestService" name="ConfigurationManagerTcp">
      <identity>
      <dns value="CN=bonkers.gendac.co.za" />
      </identity>
      </endpoint>
      </client>
      </system.serviceModel>

      Now, I need to be able to set the EndpointAdress in code, which is simple

      myService.Endpoint.Address = new EndpointAddress(textBox3.Text);

      But, this make the EndpointIdentity NULL... So one can set the EnpointIdentity as follow:

      myService.Endpoint.Address = new EndpointAddress(new Uri(textBox3.Text), epIdentity,
      System.ServiceModel.Channels.AddressHeader.
      CreateAddressHeader("ConfigurationManagerTcp",
      textBox3.Text, 1));

      The ques

      J Offline
      J Offline
      JoeTcs
      wrote on last edited by
      #2

      Hi Hugo Human try the below code string dnsName = ConfigurationSettings.AppSettings["DnsName"]; if (string.IsNullOrEmpty(dnsName)) throw new Exception("Invalid Configuration for Dns Name"); Uri uri = new Uri(url); AddressHeader ah = AddressHeader.CreateAddressHeader("SomeName", url, 1); EndpointIdentity identity = EndpointIdentity.CreateDnsIdentity(dnsName); endpointAddress = new EndpointAddress(uri, identity, new AddressHeader[] { ah });

      B 1 Reply Last reply
      0
      • J JoeTcs

        Hi Hugo Human try the below code string dnsName = ConfigurationSettings.AppSettings["DnsName"]; if (string.IsNullOrEmpty(dnsName)) throw new Exception("Invalid Configuration for Dns Name"); Uri uri = new Uri(url); AddressHeader ah = AddressHeader.CreateAddressHeader("SomeName", url, 1); EndpointIdentity identity = EndpointIdentity.CreateDnsIdentity(dnsName); endpointAddress = new EndpointAddress(uri, identity, new AddressHeader[] { ah });

        B Offline
        B Offline
        bonkers123
        wrote on last edited by
        #3

        ta

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups