I am facing a weird problem and no body seems to have a solution for it.
The thing is that i am working on a Sharepoint application. It was working fine until our organization underwent a network maintenance.
The next day i try to run my application and kaboom!! it throws me an 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: Named Pipes
Provider, error: 40 - Could not open a
connection to SQL Server)
I later found out that during the maintenance the IP of my machine has changed.
It is possible that the change of an IP could result in my sharepoint application not working!!
I did my research and found that nothing has been changed in my application and that the SQL server (which is on my machine itself) is working fine! And still my application is DEAD!!
Please help, any suggestions will be helpful!
thank you.
DON'T PANIC!
The error message is pretty clear and it's not related to Sharepoint. Your web application can no longer connect to the database.
Perhaps you have configured Windows Firewall (or another firewall) to allow connections to the database using your old IP. Maybe you haven't enabled Named Pipes or you have hard-coded the old IP address in your hosts file. Or maybe your web application's account can no longer connect to the database. Changing a server's IP is no small change so maybe someone did a few more modifications as well.
If you can connect to your Central Administration site the problem is probably related to the Web Application's account. If you can't connect to Central Admin, the problem is related to the database connection.
To check the connection try to connect to the database using the exact same credentials (Provider Name, account, password etc.). You can do this either by using the Options tab of the SQL Server Management Studio connection dialog, or by writing a small program yourself to test the connection to the database.
Related
I'm using Azure Functions with .NET 6 on an S1-tier App Service Plan with regional VNET integration. In our scenario, we execute some SQL queries accessing an On-Prem database which works pretty fine at the first glance. Unfortunately, sometimes the virtual network connection seems to break and our queries run into following 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: TCP Provider, error: 0 - An attempt was made to access a socket in a way forbidden by its access permissions.) An attempt was made to access a socket in a way forbidden by its access permissions.
After disconnecting and reconnecting the function from VNET, it starts working again as expected (I found this approach here)
But it seems like this is just a really poor workaround. Does anybody know how to fix this indefinitely? I've already tried creating a new function app but that didn't change anything.
• According to the error that you are encountering, there might be some issues with the Firewall in the on-premises environment or the TCP/IP connection being established. Thus, I would suggest you to please check all the issues mentioned in the documentation link below and verify whether all the instances of practices mentioned in it are followed correctly: -
https://learn.microsoft.com/en-us/troubleshoot/sql/connect/network-related-or-instance-specific-error-occurred-while-establishing-connection
• Secondly, I would suggest you to please check the SQL Browser Service in the on-premises SQL Database server and check whether ‘UDP port 1434’ is whitelisted for communication between the two environments or not along with TCP 1434. Also, when executing SQL queries to access the on-premises SQL DB, ensure that the instance name is input correctly along with the port number. Also, when mentioning the port number, ensure that it is preceded by ‘,’ and not ‘:’.
• Finally, I would suggest you enable diagnostic logging for an app service plan by referring to the below documentation link that will help you figure out the reason for your connection error to the SQL DB. Also, you can browse through the Kudu console by accessing the url:- https://****.scm.azurewebsites.net/ (enter your website name instead of ****). You should be able to find the log files under the debug console. Please check if there are any failure logs: -
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs#:~:text=To%20enable%20application%20logging%20for,itself%20off%20in%2012%20hours.
https://github.com/projectkudu/kudu/wiki/Investigating-issues
Note: - Please check whether your API URL connection string used in the function app is being replaced correctly and troubleshoot your connection variables thoroughly.
I have developed a simple Web API and deployed it on an Azure server along with a SQL Server database. The database and the Web API are hosted on the same server. I can connect to the database from my development machine. If I run the Web API in Visual Studio 2017, everything works fine, I can call all Web methods and I get the proper expected response.
Now, that I deployed the Web API on the server and run it under IIS, if I make a Web API call using Postman I get this error message after about 30 seconds of wait time:
"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)"
I know this error has been discussed here many times, but none of the suggestions made help solve my problem. The hosting Azure VM is a 64-bit Windows Server 2016.
In the connection string used by my Web API I had the data source set to the computer's name, its internal Ip address, the "localhost" keyword or the "127.0.0.1" back-loop IP address, but I get the same error listed above in each of those situations. SQL Server Management Studio (running locally on the same server that hosts the database and my Web API) is able to connect to the database if I use either of the three data sources: localhost, internal IP address or computer name.
In the situation in which it works, when I run the Web API in Visual Studio, the data source in the connection string is set to the external Ip address of the Azure Server. That would be the only difference, as far as the data source is concerned.
I need to mention that I have a couple of web methods that do not require database access. These work fine and return the expected result.
Are there other specific settings that I would need to do in IIS to allow this to happen?
TIA,
Eddie
I figured what the problem was. My Web API was developed in ASP.Net Core and as such, it produces its own executable. That is looking for a config file that is named TheNameOfTheApplication.exe.config.
Due to a temporary lapse of reason, I was modifying the connection string in the "app.config" file and left the one in the "TheNameOfTheApplication.exe.config" file with the external IP address that was not correct.
Our setup:
Server1: Sharepoint is running
Server2: SQL Server is running
Our Sharepoint 2010 was working perfectly fine and then suddenly the website went down and when I tried accessing Central Admin I found the following issue in the error log:
System.Data.SqlClient.SqlException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
I read on internet that this happens when the server loses trust with the domain so I removed the Sharepoint server from the domain and then added it back. Result: Same. No solution.
I also tried other methods where people have asked for updating the host file but that too did not work.
In order to check if the connection is working or not...i did UDL test where I created a file networkcheck.udl on Sharepoint server machine (Server1) and tried running with Windows authentication and tried to connect with DB server (Server2).
Result: Connection successful.
Can anyone please guide regarding this. I don't know why Sharepoint won't connect even after udl test being successful.
Because I don't know enough about your farm as a whole you may be best looking at this as a issue unrelated to SharePoint.
Are bother the servers in the same domain?
Like Dennis said have any of the passwords Expired/Changed?
Do you have anything other than localhost pointing to 127.0.0.1 in your Hosts file?
Check this thread and think of the problem away from SharePoint
SQL Server 2008 Windows Auth Login Error: The login is from an untrusted domain
Thanks
Truez
One of the possibilities of this error could be that the account from which the Server has been installed has been removed from the domain or the account password has been changed.
Created an azure MVC website, from service (controller) code we are connecting to an on-premise sql server using Azure Hybrid Connection. Intermittently we are facing below issue.
"A transport-level error has occurred when receiving results from the
server. (provider: TCP Provider, error: 0 - The specified network name
is no longer available.)"
Please provide suggestions to resolve this issue.
You can try following solutions :
Try increasing connection time-out.
check if remote connection is enabled.
Try adding firewall exception.
First of all the error means either the networks has some extra latency, the database is down or you may have too many concurrent connections open the database.
(Make sure you are closing all open datareaders.)
also it may be due to this
These are transient faults and are to be expected in the cloud. Implementing defensive programming is usually a must in the cloud. Try using some retry logic. Microsoft's transient fault exception library is an excellent start. Though meant primarily for SQL Azure and Azure Service bus, you can use the library for SQL IaaS.
In my opinion, 98% sure, because I recently had the same experience, it is a network issue from the server provider.
For instance: if you are rent the server from Ionos, by default all remote connections are blocked, even though you disable the firewall in the server. You still won't be able to connect remotely. You can, however, do your work on the server without any problem.
To connect remotely, you have to contact the server provider. They will explain how to enable firewall ports from your control panel.
I contacted my server provider as I almost get frustrated. Here was their response.
enter image description here
After this, every permitted client can connect remotely to the server.
I wish you success.
I am trying to set up a new azure website. I have done this before and everything just worked, this time I'm having real trouble getting the database set up.
I setup both site and database in the deploy wizard, and have a connection string named the same as on my local box. The error I'm getting is below:
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)
If i copy paste the connection string from azure to my local box (and add my local ip to the whitelist for SqlAzure) then it works fine locally (which is why I'm a little stumped)
The only thing that that I have noticed is that if I download the web.config for the site as configured in azure there are no connection strings. I imagine that this is because they are doing some clever security thing.
Any idea what I can even try next to diagnose this?