Team Foundation Server (TFS) -The underlying connection was closed

Having build and upgraded Team Foundation server from 2010 to 2013, SQL Sever and Sharpoint Foundation 2013, running on VMWare ESX,  the team found very frequent and random like connection dropped problems, most frequent being:
  • connection that was expected to be kept alive was closed
  • The underlying connection was closed

This happened trying to check things in, or other source tracking related activities against Team Foundation Server.

The hunt was on the the cause, a week of investigation (on and off), heading off looking at the IIS settings, checking settings for WCF, looking for possible max connection limits, working pools and recycling logs etc.

Also investigated a post regarding network interface card (NIC) off loading and to switch it off on virtual boxes (I’m not convinced by that).


For others in a similar position, I present our solution, the static IP address that was assigned to the server had accidentally had a a printer assigned to it too. So whenever the user came in to work and put the printer on (not every day), we would experience these problems, for a bit, until the printer went off again. All due to the duplicate IP address.

How to make GP company login text boxes longer

In the blog post series by David Musgrave, he shows how to customise the GP company login boxes, to make them long enough to see very long company names in full. David uses Dexterity in the third part of the series. However in the latest he attempts to do the same using an addin, albeit he “cheats” by passing in the SanScript. Note this is not a supported method.
By using the Continuum COM library to allow .NET code in the Dynamics GP Visual Studio addin to pass SanScript through to the GP we CAN do it, see how I did it!

The original article can be found here:


Customising the Company Login window series Part 4 - Visual Studio Toolsby David Musgrave

So David had a problem getting it working, I had Visual Studio open on my Addin project, so I gave it a go.

Make a reference to the Continuum

This is a COM object in, so go to your project reference and search for “contin” and then add the reference. Ensure you marry the version number with the version of GP you are using.


Store the script in a project resource

Under the project settings, you can store resources. This is a good place to put your scripts as it deals with line feeds and keeps them in an intact form for future editing.

Go to the resources tab of the project properties, create a new resource and paste in the script provided by David. We are going to use the .NET code to run the script, so we don’t need to put it in a procedure, only take the fragment that does the deed. Name the resource LoginResizeScript


Add event handler

Now when the company login window is opened we want to execute the script to resize the text boxes on that window. So to me it seems like a good plan to add and event handler to the company switch form. Now go to your GPAddin.vb and add and event handler like this for the company switch form.

Sub Initialize() Implements IDexterityAddIn.Initialize
'You should add code to only execute once in lifetime
AddHandler Microsoft.Dexterity.Applications.DynamicsDictionary.OpenSwitchCompanyFormProcedure._Instance.InvokeAfterOriginal, AddressOf DoLoginResize

End Sub

Deal with the namespaces

Important as the project reference messes you up!

Imports DynamicsGP = Microsoft.Dexterity.Applications.Dynamics

Execute the script

So next the script needs to run in response to the event firing on the Switch Company event handler. Add the following to your GPAddin.vb .

The SanScript is now held in a project resource we can reference by My.Resources.Resources.LoginResizeScript so we push this into the ExecuteSanscript method.

Public Sub DoLoginResize(sender As Object, e As EventArgs)
Dim CompilerApp As New Dynamics.Application
Dim CompilerMessage As String = Nothing
Dim CompilerError As Integer
' Execute SanScript in Dynamics GP
CompilerError = CompilerApp.ExecuteSanscript(My.Resources.Resources.LoginResizeScript, CompilerMessage)
If CompilerError <> 0 Then
End If
End Sub

Resulting resized controls – it works!


And hey it works from VB.NET too! I love Visual Studio and Dynamics GP!

“The Installation of this package failed” Sharepoint 2013 Server 2012 R2

On attempting to install team foundation server I encountered the following error trying to install sharepoint 2013 foundation.


This was after the installation had failed and on trying to run the installer again.

To clear this dialog box and run the installer again I used filemon to see where the extracted installer was running from and deleted that directory, in my case:

c:\program Files (x86)\MSECache\SharePoint2010


The original problem was the pre-requisites could not be downloaded by the installer, due to IE protection mode.