How to set up a wcf-structure over internet, and not on the localhost
Posted
by djerry
on Stack Overflow
See other posts from Stack Overflow
or by djerry
Published on 2010-05-26T12:15:23Z
Indexed on
2010/05/26
12:21 UTC
Read the original article
Hit count: 380
Hey guys,
I want to convert the wcf-structure i have from localhost to a service which runs over the internet. My server starts when replacing the localhost with my ip-address. But then my clients cannot connect to the server anymore. This is my server setup :
static void Main(string[] args)
{
NetTcpBinding binding = new NetTcpBinding(SecurityMode.Message);
Uri address = new Uri("net.tcp://192.168.10.26");
//_svc = new ServiceHost(typeof(MonitoringSystemService), address);
_monSysService = new MonitoringSystemService();
_svc = new ServiceHost(_monSysService, address);
publishMetaData(_svc, "http://192.168.10.26");
_svc.AddServiceEndpoint(typeof(IMonitoringSystemService), binding, "Monitoring Server");
_svc.Open();
}
My app.config for the client looks like this :
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IMonitoringSystemService" closeTimeout="00:00:10"
openTimeout="00:00:10" receiveTimeout="00:10:00" sendTimeout="00:00:10"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="500"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="100000"
maxBytesPerRead="100000" maxNameTableCharCount="100000" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://192.168.10.26/Monitoring%20Server"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMonitoringSystemService"
contract="IMonitoringSystemService" >
<!--name="NetTcpBinding_IMonitoringSystemService"-->
<identity>
<userPrincipalName value="DJERRYY\djerry" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
© Stack Overflow or respective owner