WCF client and specific port

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
i've got the application wich use WCF communication. Because firewall, I
need open client port on specific number, but I can't find where it should be
set up. Can anyone help me?

this is my app.config of my client app.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IServer" 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="100"
maxBufferPoolSize="2097152"
maxBufferSize="524288" maxConnections="100"
maxReceivedMessageSize="524288">
<readerQuotas maxDepth="64" maxStringContentLength="16384"
maxArrayLength="16384"
maxBytesPerRead="16384" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="10:00:00"
enabled="false"/>
<security mode="Transport">
<transport clientCredentialType="Windows"
protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://172.22.1.143:8737/conobs" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IServer"
contract="CC.Exchange.IServer"
name="NetTcpBinding_IServer"/>
</client>
</system.serviceModel>
</configuration>


and this is how I make client connection:
InstanceContext con = new System.ServiceModel.InstanceContext(new
ReceiveMessages(ref message, ref update));
iServer = new ServerClient(con);
 
You can change the client endpoint like this.

client.Endpoint.Address = new
System.ServiceModel.EndpointAddress("NewURL:NewPort");

However, you server has to be configured to be listening on whatever port
you specify otherwise it won't work.
 
There are service and client. Service is listening on 8737, and client is
connecting to service, and open his own port for callback. But I don't known
where I can specify which port client should to open (for callbacks).

Thank you

Honza
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top