I have a problem with my WCF in a C# appliction. I am able to call the Service when server and client are on the same PC, but i get a timeout on the request if server and client are on different PCs. I have opened the ports in the firewall (I use port 9998) and I even tried to shut the firewall down. The app.config of the server looks like following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="SMS_ServiceBehavior">
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="SMS_ServiceBehavior" name="SMSapplication.SMS_Service">
<endpoint address="http://10.20.5.100:9998/SMS_Service" binding="basicHttpBinding"
bindingConfiguration="" name="SMS_ServiceEndpoint" contract="SMSapplication.ISMS_Service" />
<endpoint address="http://10.20.5.100:9998/mex" binding="mexHttpBinding"
bindingConfiguration="" name="mex" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
Does anyone please have an idea what else I could try or where the error could be?
The config file of the client looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SMS_ServiceEndpoint" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:9998/SMS_Service" binding="basicHttpBinding"
bindingConfiguration="SMS_ServiceEndpoint" contract="SMS_Service.ISMS_Service"
name="SMS_ServiceEndpoint" />
</client>
</system.serviceModel>
</configuration>
I take care in the code by following:
SMS_Service.SMS_ServiceClient client = new SMS_Service.SMS_ServiceClient();
client.Endpoint.Address = new EndpointAddress(new Uri("http://10.20.5.100:9998/SMS_Service"), client.Endpoint.Address.Identity, client.Endpoint.Address.Headers);
client.Open();
client.DoWork("test");
client.Close();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.