none
Problem with binding to another IP address/port RRS feed

  • Question

  • Hi,

    I have a wcf client that cannot contact my service, it needs to send a soap message via https then http, hence it requires (I believe) a physical & logical address to achieve this, it also needs to bind to a different IP address+port, I have tried several variations of the following:-

    var localIpAddress = IPAddress.Parse("nnn.nnn.100.138");
    var hasLocalAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList.Any(ip => ip.AddressFamily ==   AddressFamily.InterNetwork && ip.Equals(localIpAddress));

    ServicePoint sPoint = ServicePointManager.FindServicePoint(new Uri(this.logicalAddr.Text));
    sPoint.BindIPEndPointDelegate = (sp, rm, retryCount) => { return new IPEndPoint( localIpAddress, 443); };

    WCFClientServiceModel myclient = new WCFClientServiceModel(this.logicalAddr.Text, this.physaddr.Text);

    note: 'WCFClientServiceModel' is my class, the ip address value above is deliberately obscured for obvious reasons.

    So far as I can tell, this delegate never fires, I just look at what WireShark can 'see' and the address never changes.

    I also employ the 'clientvia' behaviour but in code, therefore I have also done the following...

    ChannelFactory<IService1> Channelfactory = new ChannelFactory<IService1>(getCustomBinding()
                                                                                            , getEndPointAddress(logicaladdr)
                                                                                           );

    Channelfactory.Endpoint.Behaviors.Add(getClientViaBehavior(physicaladdr));

    The logical address is 'http:\\xxx' the physical address is 'https:\\yyy' etc.

    I monitor the process with WireShark, but it never succeeds in contacting the server; I know it's possible as I have employed a SOAP UI project that successfully calls my web method.

    If anyone can assist with this, I'd be most grateful, if you are near enough to London, then a few beers are on offer!

    I have probably trawled every single site that refers to this issue, but most are either inappropriate or so incomplete that it's difficult to understand what they are trying to acheive.

    I'm exasperated by WCF!!!

    Friday, February 21, 2014 11:06 AM

Answers

  • I don't know all the setting for wcf  so I can't help with the specifics but can make some comments.  You should always use the computer name (not IP) when you have DHCP enabled.  When DHCP is configured the network is using group policies which requires getting a IP address from a password server.  When DHCP is being used the IP addresses of computer will change regularily (2 - 3 weeks) while the computer name will always remain the same.

    I would start debugging the issue by using a remote terminal connection to make sure you have access rights to login from on ecomputer to another.  Also try in a cmd.exe window ping trying the ip address and then the computer name.  If ping doesn't work you probably have a group policy credential issue.


    jdweng

    Friday, February 21, 2014 12:27 PM

All replies

  • I don't know all the setting for wcf  so I can't help with the specifics but can make some comments.  You should always use the computer name (not IP) when you have DHCP enabled.  When DHCP is configured the network is using group policies which requires getting a IP address from a password server.  When DHCP is being used the IP addresses of computer will change regularily (2 - 3 weeks) while the computer name will always remain the same.

    I would start debugging the issue by using a remote terminal connection to make sure you have access rights to login from on ecomputer to another.  Also try in a cmd.exe window ping trying the ip address and then the computer name.  If ping doesn't work you probably have a group policy credential issue.


    jdweng

    Friday, February 21, 2014 12:27 PM
  • Hi,

    Did you ever manage to solve this? I'm having exactly the same issue.

    Regards,

    Diederik

    Wednesday, April 2, 2014 11:14 AM