简体   繁体   中英

Server Error in '/' Application (error: 26 - Error Locating Server/Instance Specified) in Azure

I have a web application ASP.NET in VB.NET in Azure, which connects to a database. The database is also in Azure, in the same resource group.

But when my app tries to connect with the database, this error appears:

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)

How do I configure my app in order to establish the connection with the database? Which is the correct connection string? Where do I have to paste it?

As you see, I'm a complete noob. Azure shows perfectly all the.aspx pages, and the database runs the querys fine. But it seems to be that I cannot establish the connection between the app and the database.

In the black square you can see where I get the connection string from. In the red square you can see the connection string I copied and pasted in the web.config file and in the vb code of my app. But it still doesn't work:

connection string

I also added a new connection string in my app, setting the connection string I got as the value:

connection string 1

Thanks in advance for your help.

For anyone having my same problem, I've found the solution.

The problem was that my vb code had the connection string. So, it was useless to change the connection string only in the web.config file.

So, in my vb code I wrote a reference to my connection string, via the name of it.

Then, when the app was in Azure, I changed the connection string in the web.config.

And it worked;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM