I have a web app that I developed using Visual Web Developer 2010. The database is local inside the solution:
<add name="SFDBConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SFDB.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
I'm trying to run the app on another machine using Visual Studio 2010 instead of the web developer and it's giving me the following error when it tries to connect to the database:
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)
Does anybody has any idea on what could be happening?
Usually, this error message means exactly what it says...
Can you connect to the SQL server through UI client (like, management studio)? If yes - how do you do that (user/password or Windows authentication; what is the server name)?
What is the connection string? You put here the connection string to SQL Express (which works; so it isn't quite helpful) - but forgot to put the connection string that doesn't work.
If you can connect in UI, and connection string is correct - there is no reason why the code would throw an error!
Related
I'm currently setting up a remote SQL Server. Made all steps regarding remote connection (as found on http://blog.citrix24.com/configure-sql-express-to-accept-remote-connections/).
Let's say my servers are :
WEB
SQL
I can connect from WEB, using SQL Server Management Studio, to my SQL Server using my connection string. Using the same connection string in my web.config does not work, keep getting error 26 - Error locating server.
Connection string:
Data Source=169.254.196.1,1433;Initial Catalog=MyDb;User ID=myuser;Password=mypassword
Any ideas?
Hi i want to publish my application in a IIS server.
First i create a database in my sql server and put all my needed data on it.
Then i update my web.config to use the new remote Database. Unfortunatly i get an error
ConnectionString:
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=IntranetDatabase;Data Source=SRVDEV2010\SRVDEV2010" />
Stacktrace :
[SqlException (0x80131904): 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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
I cheked if i can access database remotly. I create a udlfile to verify my connectionstring, Here is the result.
I don't know why the udl file can connect but not my application. Any help is appreciated
Under which user is the Application Pool configured to run? you're using Windows Authentication which means your IIS App pool should be configured to run under a user that has access to the DB.
I'm using Visual Web Developer 2010 Express on my laptop to run some ASP.Net which is trying to access an Oracle database on another machine.
I've having some difficulties executing ...
SqlConnection myConnectionTest = new SqlConnection(s);
... and before I went any further I thought I should check .... does VWD2010 impose some sort of limitations on accessing remote databases ?
[Not sure if this is relevant the connectionStrings entry to oracle is using a TNS-less connection string like this :
<add name="ABC" connectionString="providerName="OraOLEDB.Oracle";Data Source=//foo.bar.com:1521/dev10.foo.bar.com;User Id=auserid;Password=apwd;"/>
There are no limitations that would prevent access to an Oracle Database
What is "missing" in the Visual Studio 2008 Express Editions?
This may be of some value:
Tips on Oracle Connection Strings
Mitch Wheat
Interesting point about the provider aspect of the connection string. If I don't put it into the string so that the connection string looks like this ...
<add name="ABC" providerName="OraOLEDB.Oracle" connectionString="Data Source=//foo.bar.com:1521/dev10.foo.bar.com;User Id=auserid;Password=apwd;"/>
... then I get an error which suggests that VWDC is trying to connect to a SQL Server database !
Ex.Message = 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: 25 - Connection string is not valid)
... the way that it seems to be defaulting to SQL Server which was what made me wonder initially whether there was some lim itation within VWDC.
Any comments on this welcome !
According to connectionstrings.com, a TSN-less connection string has the form:
Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myHost)(PORT=myPort)))(CONNECT_DATA=(SID=MyOracleSID)(SERVER=DEDICATED)));User Id=myUsername;Password=myPassword;
Is 'providerName' also accepted?
I have domain on the godaddy.com. I have create the database over there.I am able to connect to the database from godaddy.com site with specified user name and password. but when i am going to use same information in my connection string in my asp.net web application on local machine it is showing
"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:
Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
This error.
my connectionstring is :
<add name="MyConnectionString"
connectionString="Data Source=myDataSource; Initial Catalog=MyDatabaseName; User ID=MyUserId; Password=MyPassword" providerName="System.Data.SqlClient" />
I have provided all required parameters to connection string here.I got this parameter information from godaddy.com database Description section.
You can't do that, their SQL server don't accept external connections.
[EDIT] OK, it seems that my first sentence is incorrect, look here:
http://community.godaddy.com/help/article/4978
http://community.godaddy.com/groups/web-hosting/forum/topic/ms-sql-remote-access/
http://help.godaddy.com/article/4977
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)
when i upload my site on webserver and connect with remote sqlserver2005 using connection string....
<connectionStrings>
<remove name="ConnectionString"/>
<add name="ConnectionString" connectionString="Data Source=69.16.253.19,1433;Initial Catalog=vb_usa;Persist Security Info=True;User ID=username;Password=password" providerName="System.Data.SqlClient"/>
</connectionStrings>
it produces the following errr --
you can see error in my webpage :
http://vbi.volvobusesindia.com
it shows an error above ..
i m using aspnetdb.mdf in my website in APP_Data Folder... features i use in my website is Login Control, Password recovery, signup control...
Tried all the above but did not work for me. When I checked Services, I found that the SQLExpress service which was set Automatic, was not started. Once I started the SQLExpress service, everything worked.
See the guide in this site http://www.connectionstrings.com/sql-server-2005
In particular look at the section on that page titled "Attach a database file, located in the data directory, on connect to a local SQL Server Express instance"
The format is:
Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;
Database=dbname;Trusted_Connection=Yes;
Basically, you need to connect to the SQL Express instance installed on the web server and point it to where your database file is located.
On that remote machine (63.15.223.19), the SQL services are not running. You can go to that machine and try to run "net start mssqlserver" from command prompt.