SQL Error login with ASP.NET - asp.net

Hi I am facing a problem with running exercise file of asp.net Quiz engine when try to make login as admin this message show up in the browser
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)

The first place I would look would would be My Computer > Manage and then click on Services. Scroll down to SQL Server, and verify that the service is started (I noticed on my development environments that occasionally my service will not start event though it is set to automatically start. Also, are you running a default or named instance of SQL Server? If your service is started, and you think your connection string is correct, could you include your connection string (obviously omit any username/password credentials) so that I can see what that looks like?

Related

After upload my ASP.NET site cannot login to the admin panel

i have developed an asp.net web site for university. in visual studio i gave the server hosted sql server database connection string. not the local one. then when i run it on the local host with server hosted sql server database it allows me to log in to the admin panel.
but after i upload the same set of files which use the same server hosted database connection string, when i try to loging using asp.net template login from to my admin panel, it shows follow error. but in the local host the same hosted sql server worked properly.
i used here asp.net configuration to create the admin and only allowed administrator to access administration folder which has all the side administration pages.
please help me to fix this... thank you!!
Error message
Server Error in '/' Application.
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)
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: 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)
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Are you using an IP address for your connection? If the database is on the same server as your application you will need to use the home address "127.0.0.1" plus any port configuration you might have. Otherwise it wont find itself.
Same goes if your using a URL connection, you might need to add the URL to the server host file so it redirects back home.
The fact that you can connect from your local dosnt mean anything. Its clearly telling you the problem, your "SERVER" cant connect. Do you have Remote Desktop access? If you can, remote into the server and try connecting to your DB from there.

SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified while connecting via asp.net application

While connecting to SQL Server 2012 Express from Asp.Net application, I get the following exception:
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)
Though, I can connect remotely to the SQL Server but once I published the application to the server where the db resides, I got the above exception.
I tried various approaches shared on net but nothing worked for me. Any suggestions?
There should be a problem in your connection string. check the instance name from Sql Server and then paste that instance name in your connection string.
This error is one of the worst, because you normally don't know what exactly the problem is. Here are some possible solutions:
Check that the server name is correct
Check that the instance name is correct
Check that your server is reachable (seems not to be your problem)
Check that the SQL Browser service is running
Check the firewall rules
Sometimes SQL Error 26 just hides another problem with the connection (f.e. SQL Error 0).

A network-related or instance-specific error Only in ASP.NET

I am getting “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)” Error when connection throw ASP.NET ONLY . if I try to connect windows application I am able to connect and retrieve values.
I am unable to find any solution
Thanks
Sometimes the simplest things can be the trickiest to discover. I would check to ensure nothing as simple as a typo exists in the name of the SQL Server provided to the ASP.NET application. Make sure that value does, in fact, match that supplied to the Windows application.
If the name is verified correct, I would then make sure that the outbound connection from the ASP.NET application isn't inadvertently trying to go through a proxy server.

Error when connect to remote SQL Server

I try to connect to remote SQL Server 2008 Express database from my ASP.NET web application but error throws:
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)
How to resolve that problem. Thanks!
Here's the first thing to check. By default Express only has the shared memory protocol enabled. You'll need to enable TCP/IP protocol for the service (SQLEXPRESS). You do this through the SQL Server Configuration Manager.
Also since Express is a named instance, you'll need to ensure that the SQL Server Browser service is started.
Make sure your connection string is correct. When you are hitting a named instance (SQLEXPRESS in this case) you need to have the data source as yourServer\sqlexpress.
And not to mention, make sure you can ping the box that houses the instance.
Check those things out and let me know if that still doesn't fix it.
i thing your connection string is not correct. Also check a named instance you try to data source as IPaddress\sqlexpress. Like 000.000.000.000\SqlExpress

sql database connection on remote server

i create my web site on asp.net and i create database in sql using inbuilt it in visual studio i use step to create database 1.right click on solution explorer then add newSqldatabase then ok then if i connect it by coding then it will work on my local PC but actuall i am making website so i want to store it on my web server then if i load databse file (.mdf) file in my web server where my all files are loaded then it is showing it 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)"
so please help me
and send me all step how i create database and what coding i use to connect on remote server.......
Thank You......
You'll want to look up connection strings to become familiar with the format of them, then it's basically a case of making sure your parameters are correct.
Check out http://www.connectionstrings.com/sql-server-2005.
The connection strings are typically stored in web.config. Some examples are here:
http://weblogs.asp.net/owscott/archive/2005/08/26/Using-connection-strings-from-web.config-in-ASP.NET-v2.0.aspx

Resources