Accessing WCF service dynamically through c# application
<p>I have created a WCF service and hosting that service through Windows Service. I have started windows service. Now when I try to access WCF service dynamically through c# application by writing the below code:</p>

<pre><code>string endPointAddr = "net.tcp://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/";
NetTcpBinding tcpBinding = new NetTcpBinding();
tcpBinding.TransactionFlow = false;

tcpBinding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;
tcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
tcpBinding.Security.Mode = SecurityMode.None;

EndpointAddress endpointAddress = new EndpointAddress(endPointAddr);

IService1 proxy = ChannelFactory&lt;IService1&gt;.CreateChannel(tcpBinding, endpointAddress);

using (proxy as IDisposable)
{
    MessageBox.Show((proxy.GetData(10)));
}
</code></pre>

<p>It will give this error:</p>

<blockquote>
  <p>Could not connect to
  net.tcp://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/.
  The connection attempt lasted for a time span of 00:00:02.0904036. TCP
  error code 10061: No connection could be made because the target
  machine actively refused it 127.0.0.1:8732.</p>
</blockquote>

<p>Please resolve my problem.
Thanks.</p>
