Your site runs under IIS and fails on the first database call with this message: A network-related or instance-specific error occurred while establishing a connection to SQL Server. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
You may also see the variants "The client cannot connect to the server because the requested instance was not available" or "SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified". They all mean the same thing: the client on the IIS machine never reached a SQL Server instance that answered.
This guide orders the checks by how often they turn out to be the cause. Start at the top and stop when the error is gone.
What the error tells you
The message is raised by the client side, which here is your application running inside IIS. It says the connection could not be established. It does not say that the login failed or that a query was wrong.
That difference narrows the search. You are looking for a problem with the name, the instance or the path to SQL Server, not with permissions inside the database.
The message itself names two suspects: the instance name, and whether SQL Server allows remote connections. Those are the first two places to look.
A useful habit: the same application often works on a developer machine and fails on the IIS server. If so, something differs between the two environments. Compare the connection settings the IIS site actually uses with the ones that work.
Step 0: read the logs before you change anything
Open Event Viewer and the IIS logs on the server first. The ASP.NET Core hosting troubleshooting page recommends this as the way to identify the root cause of a failing IIS-hosted app, and it applies here.
Look for the full exception text. It tells you which variant of the error you have, and it often includes the server and instance name the application tried to reach.
Write that name down exactly. You will compare it with the real name in the next check.
If the application starts but fails on the first database call, the problem is in the connection. If the application does not start at all, fix that first using the ASP.NET Core on IIS troubleshooting page, then return here.
Cause 1: the server or instance name is wrong
This is the most common cause. The error message itself says to verify that the instance name is correct, and the error 26 write-ups list the same two checks first.
What to check
- Confirm the server name has no typo.
- Confirm the instance name is correct and that such an instance actually exists on that server.
A named instance is addressed as server name, a backslash, then instance name. Written as a placeholder, that is YOUR_SERVER\YOUR_INSTANCE. A default instance is addressed by the server name alone. If you add an instance name for a default instance, or leave it off for a named one, the client cannot locate the instance.
Fix
- Get the correct server and instance name from the database owner. You do this because a name copied from an old document is a frequent source of the error.
- Open the application's configuration on the IIS server and compare the name in the connection string character by character. You do this because the deployed file can differ from the one on your development machine.
- Correct the name, save the file and recycle the application so it reads the new value.
If the application takes its connection string from an environment variable or from a settings override on the server, change it there. The value in the file is ignored when an override exists.
Cause 2: the instance is not available
The variant "the requested instance was not available" points here. The name is right, but nothing is answering for that instance.
What to check
- Whether the SQL Server instance is running on its host.
- Whether the host itself is up and reachable from the IIS server.
You must check this on the SQL Server machine or ask its administrator. The steps to start the service and read its status depend on your setup, so follow the official SQL Server documentation for your edition.
Fix
- Start the instance if it is stopped. You do this because a stopped instance cannot answer any client.
- If it stops again by itself, ask the administrator to read the SQL Server error log on that host. You do this because the reason it stops is recorded there, not on the IIS server.
If the server name resolves but the instance does not respond, treat it as an availability problem on the SQL Server side, not as an IIS problem.
Cause 3: SQL Server does not allow remote connections
The error text says to verify that SQL Server is configured to allow remote connections. This matters when IIS and SQL Server run on different machines, which is the normal production layout.
A SQL Server that was set up for local use only will answer on its own machine and refuse every other machine. The symptom is exactly this error, only on the server that hosts IIS.
What to check
- Whether the instance is configured to allow remote connections.
The exact menu path or setting name varies by tool and edition, so check the official SQL Server documentation for the page on allowing remote connections before you change anything.
Fix
- Ask the SQL Server administrator to enable remote connections for the instance. You do this because the change is made on the database server and needs rights you may not have.
- Restart the instance if the documentation for your edition says a restart is required. You do this because some settings only apply after a restart.
Other network-level items can also block a remote client, such as a firewall between the machines or the protocols enabled on the instance. Their configuration differs between environments, so confirm them against the official SQL Server documentation and with your network team.
Cause 4: IIS is configured like the working machine but behaves differently
A common report is that IIS on a new server is configured the same way as an older one, yet the new one raises this error. When the settings look identical, the difference is usually outside the IIS settings.
What to check
- The connection string the new site actually loads, not the one you believe it loads.
- Whether the new server can reach the SQL Server host by the name used in the connection string.
- Whether the SQL Server was set up to accept connections from the old server only.
Fix
- Reproduce the failure from the logs. Take the exact name from the exception in Event Viewer and use it in your checks. You do this because it removes guesswork about which configuration is live.
- Ask the SQL Server administrator whether the new server needs to be allowed. You do this because access rules on the database side can be tied to specific client machines.
- Repeat the Cause 1 to Cause 3 checks from the new server's point of view.
The documentation does not describe a specific IIS setting that causes this error on its own. If you suspect one, look at the ASP.NET Core on IIS troubleshooting page.
Confirm the fix worked
Do not stop when the page loads once. Confirm the change with the same evidence that showed the problem.
- Recycle the application, then request a page that reads from the database. You do this because the first database call is where the error appeared.
- Open Event Viewer and the IIS logs and look for new entries after your change. You do this because a page can render from cache while the connection still fails.
- Check that the error text no longer appears for the server and instance name you wrote down in Step 0.
- Repeat the request a few times over several minutes. You do this because an instance that stops by itself can pass a single test.
If the error is gone from the logs and the data page returns database content, the connection works.
If the message changed to a login failure or a permissions message, the network problem is solved. You have reached the database, and the next problem is about credentials or access inside SQL Server.
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| The error says SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified | The client could not find the server or the instance. The usual reason is a typo in the server name or an instance name that does not exist on that server. | Check the server name for typos, then check that the instance name is correct and that the instance exists. Correct the connection string and recycle the application. |
| The message says the client cannot connect because the requested instance was not available | The name resolves but the instance is not running or not reachable. | Ask the SQL Server administrator to confirm the instance is running and reachable from the IIS server. Follow the official SQL Server documentation for your edition. |
| The application works on the developer machine and fails only on IIS | The IIS site loads a different connection string, or the SQL Server does not accept connections from the IIS machine. | Compare the connection string the IIS site loads with the working one. Verify that SQL Server is configured to allow remote connections. |
| The site fails to start and no database error appears | The failure is an IIS hosting problem, not a database one. | Read Event Viewer and the IIS logs, and use the ASP.NET Core on IIS troubleshooting page to fix hosting first. |
| The error text changes to a login or permission message after your fix | The network path now works and the next failure is inside SQL Server. | Treat it as a separate problem about credentials or access and work from the new message. |
Frequently asked questions
What does 'A network-related or instance-specific error occurred' mean?
The client could not establish a connection to SQL Server. The message tells you to verify that the instance name is correct and that SQL Server is configured to allow remote connections.
What is SQL Network Interfaces error 26?
It is the 'Error Locating Server/Instance Specified' variant. Check that the server name has no typo and that the instance name is correct and actually exists.
Where do I start when IIS shows this error?
Open Event Viewer and the IIS logs and read the full exception. Then check the server and instance name in the connection string.
Does this error mean my password is wrong?
No. The error is about locating or reaching the instance. A wrong password gives a different, login-related message once the connection works.
Why does it work on my machine but not on IIS?
Something differs between the two: the connection string the IIS site loads, or SQL Server accepting connections from the IIS machine. Compare both.
Is this an IIS problem or a SQL Server problem?
Usually the name or the SQL Server side: a wrong instance name, an unavailable instance or remote connections not allowed. Failures to start the site are an IIS hosting problem.
From Grokem: https://www.grokem.com/programming/web-development/backend/iis-cant-connect-to-sql-server-fix-the-network-related-or-instance-specific-error









