Tuesday, June 12, 2012

SQL Server Management Studio Cannot Connect

A developer complained to me that he was not able to connect to a SQL Server 2005 server using SQL Server Management Studio.

The screen shot below is the error he was getting when he tried to connect.

Unrecongized configuration section system.serviceModel

Following the stack trace from “The type initializer for ‘System.Data.SqlClient.SqlConnection’ threw an exception. (System.Data)” to “Unrecognized configuration section system.serviceModel. (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config line 134)(System.Configuration)”, it seems like the machine.config was misconfigured.

The problem is where in the machine.config was misconfigured.  From the error message, it seems to indicate line 134 of the machine.config was causing the error.  I opened the machine.config and go to line 134 but there is nothing wrong with the line.

I could have replace the bad machine.config with a good machine.config from another machine but I really want to know what are the configurations causing the error in cause the developer needs to know.  The most straightforward way is to use a file compare utility to compare the bad machine.config with a good one.

The comparison shows that the following three section groups were missing from the bad machine.config file.

  • system.runtime.serialization
  • system.serviceModel
  • system.serviceModel.activation

I copied the missing section groups from the good machine.config to the bad one and the problem has been resolved.

No comments: