;

TFS woes. Trying to access a TFS server over the internet from Team Explorer–checking port access

Posted : Sunday, 05 February 2012 13:09:00

I’ve been working with a client recently to sort out their codebase and make it a bit more manageable as well as provide a solid scalable platform for planned future expansion. There are a number of legacy servers kicking about and some of them including the VCS Server are Win2k3 IIS6 – previously the client was running SubVersion which performed admirably and was a lot better than nothing (which would be even better than SourceSafe Winking smile). We decided to take the plunge and move to TFS for a number of reasons:

  • The client is a Microsoft Academy so licencing was already covered
  • Far better integration with Visual Studio
  • Automated builds
  • Tracking/reporting facilities
  • Superior branching/Merging facilities

We did the install a couple of weeks back and spent a day refactoring the existing code to sit a logical hierarchy of team projects aimed at maximising reuse of code. All was going great with a noticeable boost in productivity then disaster. We lost internet access to the TFS server. I work remotely from home most of the time and this was critical as going to the client site every time I needed to checkin/checkout WAS NOT going to happen. After much head scratching we were getting nowhere, to compound things, the client use a third party ISP to manage their firewall so that just added another variable into the mix. The ISP was claiming that ports 8080 and 443 were open both inbound and outbound on the specified server but we just could not connect externally. In order to verify this was the case I created a very simple WCF console app app to sit and listen on a specified port which would serve to verify port access. Running this same app on both ends of the wire would confirm traffic flow in both directions. Its dead simple and can no doubt be improved so I’ve stuck it on Codeplex in the event that anyone else with a similar need can use or extend it.

Here is the code, service contract first:

    [ServiceContract]

    public interface IPortTestService

    {

        [OperationContract]

        string TestSend(string msg);

    }

Next a basic Implementation:

    public class PortTestService : IPortTestService

    {

        public string TestSend(string msg)

        {

            StringBuilder resultBuilder = new StringBuilder();

            resultBuilder.AppendLine("Message received");

            resultBuilder.AppendFormat("Message: \"{0}\"{1}",msg, Environment.NewLine);

            resultBuilder.AppendFormat("Recieved: \"{0}\"{1}", DateTime.Now.ToString(), Environment.NewLine);

 

            string result = resultBuilder.ToString();

 

            Console.WriteLine(result);

 

            return result;

        }

    }

That’s pretty much it, to start with I self-hosted the service in a Console app, the code is taken directly from MSDN:

        static void Main(string[] args)

        {

            Uri baseAddress = new Uri("http://SERVER:PORT/hello");

 

            // Create the ServiceHost.

            using (ServiceHost host = new ServiceHost(typeof(PortTestService), baseAddress))

            {

                // Enable metadata publishing.

                ServiceMetadataBehavior smb = new ServiceMetadataBehavior();

                smb.HttpGetEnabled = Post a comment Sharespacer

  • (This will not appear on the site)