MSSQL error ”The specified network name is no longer available”

This problem has been bugging us for a long time. When you try to connect to Microsoft’s SQL Server using IP address with SQL Management studio you get this error:
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (.Net SqlClient Data Provider)

When you dismiss the error it just keeps popping up time to time but otherwise everything seems to work. This is caused by the Management Studio attempting to connect to the SQL Server by the server name reported by the server. This can happen for example when your production environment is isolated from intranet and servers do not have fully qualified domain names.

However this is easy to fix, you just need to change the server name to correspond to the IP address of the server:

sp_dropserver <current name>;
sp_addserver 'a.b.c.d', local;

After this you need to restart the SQL Server’s instance and you are done. You can check that the new name set correcyly by running:


Working with RDLC Reports and object data sources

Yesterday I had to build RDLC report to report stuff based on business objects. I builded a data source that would open session to database, fetch objects, build data contracts and pass them to report as IEnumerable data source. Seemed simple enough I started hacking and soon got the data source ready. Next I created new Report in Visual Studio 2010 and clicked Add dataset… Blam, Visual Studio opens me wizard to create connection to database.

After hours of googling I found out that Visual Studio has a long-lived bug in it. If the project is web project where RDLC file is located, then report data sources  are not refreshed always. There is a work around though. Data sources are often refreshed if you open one .aspx file in the project. More of this bug and its work around can be found from

After creating one aspx page to project and opening it I managed to get pass create database connection wizard. At this point next problem appeared. I couldn’t find my method from Available datasets.  My method had simple signature IEnumerable GetData(). After a while thinking and reading MSDN, I realized that the report designer is actually instantiating my class and calling the method to see what types it returns. That would of course fail because SessionFactory wouldn’t exists. To work around that I added try…catch block to the GetData() method and in case of exception returned array with one item. After that and building the project,  data source appeared to report designer.