Reputation: 3035
For some days now, i'm trying to access my WCF Service from another computer on my LAN and just can't access it.
Locally it works fine though.
Majority of the similar questions i could find are using IIS to host the service.
I tried to shut down the firewall but i couldn't get any effect.
Here are the config files, please ask if you need more :
Client's App.config :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<system.serviceModel>
<client>
<endpoint name="default"
address="http://myhostIP:3100/"
binding="basicHttpBinding"
contract="ServiceInterface.IService"/>
</client>
</system.serviceModel>
</configuration>
Here is the Host App.config :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<system.serviceModel>
<services>
<service name="ServiceTest.Service">
<endpoint address="http://0.0.0.0:3100"
contract="ServiceInterface.IService"
binding="basicHttpBinding"/>
</service>
</services>
</system.serviceModel>
</configuration>
If you guys got any ideas... I couldn't find any informations
EDIT :
I'm using a console application to host the service
Telnet connection from local and remote hosts are working
EDIT 2 :
I just seen that i made a mistake copying the App.config file. The binding type should be wsDualHttpBinding
instead of basicHttpBinding
I also could get an error message :
First one is that the "Caller couldn't identicate itself to the WCF service"
I tried then to set the security to none (for troubleshooting purposes) and i only got a timeout exception
EDIT 3 :
In a console app :
static void Main(string[] args)
{
ServiceHost host = new ServiceHost(typeof(ServiceTest.Service));
host.Open();
Console.WriteLine("Server Started");
Console.ReadLine();
}
Edit 4:
The complete solution is available here https://github.com/sidewinder94/smallChatSolution
Upvotes: 1
Views: 2667
Reputation: 4959
Here is the solution for your issue.
Client's app config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<system.serviceModel>
<client>
<endpoint name="default"
contract="ChatDllContracts.IService"
binding="netTcpBinding"
address="net.tcp://myHostIp:3100/"
bindingConfiguration="mynet"/>
</client>
<bindings>
<netTcpBinding>
<binding name="mynet" sendTimeout="00:00:05" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
ChatServer's app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<system.serviceModel>
<services>
<service name="ChatDll.Service">
<endpoint contract="ChatDllContracts.IService"
binding="netTcpBinding"
address="net.tcp://localhost:3100"
bindingConfiguration="mynet"/>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="mynet" sendTimeout="00:00:05" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
Please keep in mind that you need to enable the Net.Tcp Port Sharing Service (on the server & client side) in order to get it working.
Upvotes: 2