I have an MVC4 app that was working before I started working on it today. As far as I know I did not make any changes to the connection strings.
I have a connection string set to use a SQL Server 2012 database.
When trying to run the app from my local machine I get this 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)
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.
SQLExpress database file auto-creation error:
The connection string specifies a local SQL Server Express instance using a database location within the application's App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
Sql Server Express must be installed on the machine.
If I run the app from the server that it resides on I do not get this error. I can also access the SQL Server database from both my local machine and the server with SQL Server Management Studio and Visual Studios built in Server Explorer.
Related
On my old machine, I have SQL Server 2008. I have a database placed in a specific folder.
I am now moving to a new machine and I have duplicated the setup with file placements.
On the new machine I have downloaded SQL Server 2019 Express and SQL Server Management Studio 18.
OK. So doing this simply I make sure SQL Server Express is running, open SSMS and in Object Explorer I choose "Mynewmachine\SQLExpress" - "Databases" and I click "Attach" pick my database (MDF file on local disk)
However doing this I get error:
Attached Database failed for server Mynewmachine\SQLExpress
(Microsoft.SqlServer.Smo) Additional information: An exception
occurred while executing a transact-sql statement or batch
(Microsoft.SqlServer.ConnectionInfo) A network-related or
instance-specific error occurred while establishing 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 location Server/Instance Specified) /Microsoft SQL Server)
This makes little sense. Server is running on local machine. Database files are on local machine (in fact specific database + SQL Server have always been only used locally on old/new machine). Thus there is nothing here with remote connections or anything like that.
I am wondering if this this in an instance name issues. On my new server it is called SQLEXPRESS, and on my old it was MSSQLServer. Should I install a new instance if MSSQLSERVER using the same instance name as on my old machine? Would I then be able to import more easily?
I have two ASP.NET MVC applications that connect to the same Azure SQL Server database. I've used both for a long time.
I recently reinstalled my local machine and got the files for both applications from TFS. One of them works with the database just fine. The other one can connect to the database using Visual Studio's Server Explorer using the EF connection string, but when I try to run it locally I get error 26:
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 checked my local IP is allowed through the Azure firewall. Any ideas why the second application won't run locally? A port issue or a cached file?
Thanks
My app is a small test application and I only used it locally so I never implemented the Owin Identity that was included in the generated project.
I had updated Visual Studio when I updated to Windows 10. Perhaps that made the Owin Identity mandatory. When I added a connection string for the identity system the app worked without issue again.
So it was an issue with the connection string, just not the EF connection string.
I have read this thread, however unfortunately couldn't find the solution to my problem. I have an ASP.Net Core project (that's called Rent) and it works without any problem on my local machine. However, once I publish the project to the IIS (still in development mode) I get the below error
fail: Rent.Program[0]An error occured during migration
Microsoft.Data.SqlClient.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: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
---> System.ComponentModel.Win32Exception (0x89C50118): Unknown error (0x89c50118)
The connection string is called DefaultConnection and is the environment variable. Can anyone help me please? Can provide any additional information if required.
The first thing you should check is that your SQL Server instance is up and running and that your database is still available. This error means quite literally that it can't establish a connection to SQL Server from the Secret Server application.
And you can also check follow things in your environment:
Is something blocking the connection between your Secret Server server and SQL Server?
The standard SQL port is 1433. Check with your server administrator - is the Windows Firewall in use, blocking this port on your SQL server? Check with your network administrator - is there a firewall at some point in between that has closed off this port? Keep in mind that if you use a custom port for SQL, it need to be specified the Secret Server database connection using a SQLSERVER,port type of format.
On the server hosting your SQL Server database, is the SQL Server
service running?
Open services.msc or SQL Configuration Manager to view the status of your SQL Server service.
I am trying to build a project data base SQL in my web application project (visual studio) I tried to off the firewall and I got this:
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: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
If you are using SQL Server, then do the following:
Search for "Services" in Cortona
Open the "Services" app
Scroll down to "SQL Server(MSSQLSEERVER)"
Now go to its properties and start the service
Also, make sure you are using the correct connection string.
I just installed Microsoft SQL Server Management Studio 17.2. I am trying to create a DB Engine on my local computer. My goal is to have a local demo database which I can create and modify tables.
I followed basic articles in the web saying that I only need to write my computer name as a server name and use windows authentication.
I am constantly getting this error:
TITLE: Connect to Server
Cannot connect to f.
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: 53)
The network path was not found
So to repeat again - my goal is only to be able to create database with random data. I need it for demo purposes.