TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


Forums >


LINQ To SQL Slow on Windows Server 2008 R2

Tom Ae.

9/2/2011 9:22:00 AM

Hi There
We just moved one of our .Net applications from a Windows 2003 Server to a virtual Windows Server 2008 R2 (64Bit, VMWare).

This application is a simple console application running on .Net Framework 4.0, 32Bit, that runs different jobs to select, modify and save business data to a database. For the database we use SQL 2008 R2.

Since we run the application on the Windows Server 2008 R2 we recognized, that the execution of Select-Statements with LINQ to SQL are slower than on the Windows Server 2003 we used before. We checked it with a simple LINQ Query, and that tooks about 500 milliseconds longer on Win 2008.

We use the System.Data.Linq.DataContext and get Objects from the Database with the Method GetTable<ClassXY>().

To compare te duration we took the time from creating the datacontext until the mapping from the DB-Objects back to the .Net-Objects in the application.
See the code:

System.Data.IDbConnection testConnection;
System.Data.Linq.Mapping.MappingSource testMappingSource;
using (System.Data.Linq.DataContext dc = new System.Data.Linq.DataContext(testConnection, testMappingSource))
dc.DeferredLoadingEnabled = false;

return = (from dbObject in dc.GetTable<TestTable>()
select dbObject).FirstOrDefault();

On the Windows 2008 R2 Server, the .Net Framework 4.0 is installed, and in the server features the .Net Framework 3.5.1 Features are enabled.

The application was installed on three different stages (Dev, Test, Production) on three Windows 2003 Server. Now it runs on three virtual Windows 2008 R2 Server. We have the same Problem on all three Windows 2008 R2 Server. And we even tested it on a physical Windows 2008 R2 Server; same Problem there.

Has anynone an idea what causes this difference? And what may be solution to resolve this problem?

Thanks a lot in advance!