How to solve the SQL Server is not connected in Azure when deploy the website?

Thibaut Fabrice 0 Reputation points
2024-03-06T05:49:50.4466667+00:00

My website is on fabjoey23.azurewebsites.net.

Help to avoid this two errors:

Error.

An error occurred while processing your request.

Request ID: 00-9fe33736939a1a5c2963eb30d4b132ed-3d31b53b23b27dea-00

Development Mode

Swapping to Development environment will display more detailed information about the error that occurred.

The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.

An unhandled exception occurred while processing the request.

Win32Exception: The system cannot find the file specified.

Unknown location

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: SNI_PN11, 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.)

Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, bool breakConnection, Action

SQL Server on Azure Virtual Machines
{count} votes

1 answer

Sort by: Most helpful
  1. Wilko van de Velde 2,226 Reputation points
    2024-03-06T07:49:15.1333333+00:00

    Hi @Thibaut Fabrice ,

    This error means that the website could not connect to the SQL Server instance. There are several possibilities on what is wrong.

    I found a similar thread Microsoft SSMS displaying the following instance error, and I quote CathyJi-MSFT :

    Please follow below steps to troubleshot this issue,

    1. Make sure SQL Server Service is running
    2. If a named instance, make sure SQL Server browser service is running. Make sure the instance name is spelled correct and there is actually such an instance on your target machine.
    3. Make sure SQL Server is configured to allow remote connections
    4. Examine the SQL Server error log for messages confirming that SQL is listening on the expected network interfaces and ports
    5. Test server connectivity with PING from the client machine
    6. Test port connectivity using TELNET to the server and port (from step 4) from the client machine. For example TELNET <server-name> 1433
    7. Check firewall settings if step 5 or 6 connectivity test fails

    Kind regards,

    Wilko


    Please do not forget to "Accept the answer” wherever the information provided helps you, this can be beneficial to other community members. If you have extra questions about this answer, please click "Comment".

    0 comments No comments