Question

I have encountered some troubles connecting some different machines of mine to a dedicated Windows service that runs WCF (a listener). Those machines have an external modem connected to them, which probably disturb TCP connection to the outside, but the machines should establish a connection via WCF with the aforementioned listener service.

Since all the connection I need is inside my network (different machines tough), and it seems that Windows Sharing (copying files, etc') does work, (assuming I am not mistaking and it uses the SMB protocol), I would prefer, if possible, to use that protocol, or other protocols that don't run over TCP, to have a working connection. I could not find on MSDN any help, but maybe someone has tried something like that before, or has encountered similar problems, and can help me with a solution to that.

Some code (pretty generic I guess):

private const string ServiceEndointURL = "net.tcp://localhost:6789/MyService";

used under: [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = true)] public class MyApplication : IService where IService is defined:

[ServiceContract(Name = "MyService")]
public interface IService
{
    [OperationContract]
    bool HandleMessage(Message message);
}

Other side ("client"):

string ListenerURL = "net.tcp://xx.xx.xx.xx:6789/MyService";
        ChannelFactory<IService> factory = new ChannelFactory<IService>
            (new MyNetBindings(), ListenerURL );
        IService channel = l_oFactory.CreateChannel();
        ((IContextChannel)channel).OperationTimeout = new TimeSpan(0, 1, 1);

EDIT: It seems that the external modem is taking the place of the default gateway on that machine, which is probably the cause for no connection. When manually adding a persistent route, with the original gateway (with low metrics) - it seems to be working again. Any way to automatically work around it?

Thanks in advance!

No correct solution

OTHER TIPS

So... SMB is not a transport protocol. SMB itself mostly uses TCP, but it can also run on UDP. If you want to use WCF over UDP you can (more info here), but i doubt that will work better for you.

My guess is that you have a specific problem with WCF or your network, and you should try to fix that instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top