I have two Windows Server 2012 machines. They are both part of a domain I have created. One is a web server and the other is a db server hosting SQL Server 2012. From the web server I can establish a connection to the DB server using MSSMS but from an application I have written hosted in IIS I am unable to establish a connection. I get the following error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server.
The server was not found or was not accessible.
Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I have verified that the SQL Server allows for remote connections.
I have verified that it is using the TCP/IP protocol.
I have tried fully qualifying the SQL Server machine name to include name.domain.com.
I am able to ping the SQL Server with no problem.
As I already stated I am able to establish a connection from MSSMS with no problem using both machine name and IP address.
I have shut down the Windows Firewall on both machines at this point and have added the rules that opened the following ports:
TPC/IP - 135, 1433, 1434, 2382, 2383, 4022
UDP - 1434
I even opened the ports to public just in case.
Within my application I have a static class that gives me the connection information. It looks like this:
static public class _ConnectionData
{
public static string Source = "192.168.0.33"
public static string Catalog = "dbCat";
public static string User = "dbCatUser";
public static string Password = "**********";
public static string ConnectString
{
get { return "Data Source=" + Source + "; Integrated Security=false; Initial Catalog=" + Catalog + "; User ID=" + User + "; Password=" + Password; }
}
}
I set up my Virtual Directory in IIS by just copying the app directory under inetpub\wwwroot and then in IIS admin converting it to an application.
I am at a loss at this point. Is there something special I need to do to get a connection from within an IIS hosted app? Do I need to specify a provider as part of my connect string? Are there special permissions within IIS that need to be set? My appPool is set to Integrated, is that correct?
I am already bald so at this point I am not sure what I will pull out maybe arm pit hair.