WCF: EndpointIdentity problem [modified]
-
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
-
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
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 });
-
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 });
ta