This one has me stumped. I'm not even trying to connect to a database. When this code gets to the line where I instantiate a new SqlConnection object, it just hangs there, not throwing an exception or anything. I've tried compiling it for 2.0. 3.5 and 4.0, and they all hang. Of course it works on my machine and yours, too. But I'm trying to run this code on a Windows Server 2008 x64 server, and it won't budge.
// example.cs
using System;
using System.Data;
using System.Data.SqlClient;
public class MainClass {
public static void Main(string[] args) {
Console.WriteLine("start");
SqlConnection conn = new SqlConnection(); // hangs here
Console.WriteLine("finish"); // never makes it here.
}
}
compilation (2.0): c:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe example.cs
Environment.Version
to the console and report back? Also, does the code have anything else in it besides what you posted? – ForeknowEnvironment.Version
? Should be something like: 2.0.50727.5448 – Foreknow