SQL Server 2012 connection string works fine in classic ASP (VBScript) but doesn't work in ASP.NET C# project -


i have scenario below:

i have sql server database , make operations sql server classic asp project. needed other stuffs same db project written in asp.net c#. did use host address in connection string provided hosting provider(say, host address sqlxx.123xxx\inst_xyz). provided ip port connect db, works in sql server management studio. in webconfig of c# project if use ip connects local dev machine. doesn't work after deploying hosting.

again, if use sqlxx.123xxx\inst_xyz host address in classic asp works. ip doesn't work here. my question is, host sqlxx.123xxx\inst_xyz works in classic asp, ip works in asp.net c# in local iis, host asp.net c# in hosting server ?

please note that, classic asp project in main domain , asp.net c# project in sub domain of main domain.

if use either of hosts(sqlxx.123xxx\inst_xyz or ip), error states below :

a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified)**

put this:

<add key="mycon" value="server=this_my_host;database=dbname;user id=myuser;password=dbpass;"/> 

and remove <connectionstrings>.

if connecting remote host must use <appsettings> not <connectionstrings> string.


Comments