SQL Named Instance Port Number

Heads up, you probably know the default port for SQL is 1433 but did you know the port is different for a named instance? And this port is dynamically set when you install the server. You can see what it is by looking in the registry. The below registry path is for SQL2008.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.(InstanceName)\MSSQLServer\SuperSocketNetLib\TCP\IPAll

There are more details in this article

And if you are using a named instance SQL server, don’t forget to adjust your connection string.

<add name=”MyConnString” connectionString=”Data Source=MyServerName, 51601; Initial Catalog=Northwind;user id=MyUserName;password=SecretPassword” providerName=”System.Data.SqlClient” />

Notice 51601 is the port number.


Error while installing Team Foundation Server 2010

I was trying to install TFS 2010 on a 32-bit Windows 2008 machine. In the middle of installing the .NET 4.0 framework, the installation needed to reboot the machine. So I did and when I logged back in, the system continued on its merry way. Everything went smoothly until it got to the actual TFS installation. The installation errored out with several of these errors:

“The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2908.”

After clicking through several of those modal popups, this error appeared:

Error 1935. An error occurred during the installation of assembly ‘Microsoft.VisualStudio.QualityTools.ExecutionCommon, version=”″, publicKeyToken=”b03f5f7f11d50a3a”, processorArchitecture=”MSIL”, fileVersion=”10.0.30319.1″, culture=”neutral”‘. Please refer to Help and Support for more information. HRESULT: 0x8002803F.

The Help and Support documentation did not help or support me. Running the installation 7 more times didn’t help. Installing just the TFS component without the Build Manager didn’t help. Downloading another install package from MSDN didn’t help. What did help was rebooting the system. I guess after installing .NET 4.0, there were some clean ups that still needed to be be done before it could install everything else.

Dividing by zero

Don’t forget people, dividing by zero does NOT always throw an exception. Sometimes the result is Infinity. It seems to only throw a DivideByZeroException when the zero is an integer or decimal. Here are my test results for C#.

z = 10 / y;

int y = 0; //throws exception
decimal y = 0; //throws exception
decimal y = 0m; //throws exception
double y = 0; //Infinity
double y = 0d; //Infinity
float y = 0; //Infinity
float y = 0F; //Infinity