简体   繁体   English

Azure 中“/”应用程序中的服务器错误(错误:26 - 定位指定服务器/实例时出错)

[英]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.我在Azure中有一个web应用程序ASP.NET在VB.NET中,它连接到一个数据库。 The database is also in Azure, in the same resource group.数据库也在Azure,在同一个资源组。

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. A. 与 SQL 服务器建立连接时发生网络相关或特定于实例的错误。 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.验证实例名称是否正确以及 SQL 服务器是否配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (提供商:SQL 网络接口,错误:26 - 定位指定服务器/实例时出错)

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. Azure 完美地显示了所有.aspx 页面,并且数据库运行查询正常。 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.在红色方块中,您可以看到我在 web.config 文件和我的应用程序的 vb 代码中复制并粘贴的连接字符串。 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连接字符串 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.问题是我的 vb 代码有连接字符串。 So, it was useless to change the connection string only in the web.config file.因此,仅在 web.config 文件中更改连接字符串是没有用的。

So, in my vb code I wrote a reference to my connection string, via the name of it.因此,在我的 vb 代码中,我通过它的名称写了一个对我的连接字符串的引用。

Then, when the app was in Azure, I changed the connection string in the web.config.然后,当应用程序在 Azure 时,我更改了 web.config 中的连接字符串。

And it worked;)它奏效了;)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误26的解决方案-指定错误的服务器/实例定位? - Solution for Error 26 - Error Locating Server/Instance Specified? ASP.Net错误26错误定位指定的服务器/实例 - ASP.Net Error 26 Error Locating Server/Instance Specified dotnetscorm-error:26-指定服务器/实例时出错 - dotnetscorm-error: 26 - Error Locating Server/Instance Specified SQL错误26错误定位指定的服务器/实例 - SQL Error 26 Error Locating Server/Instance Specified Azure Web服务管理给出错误的帐户链接:26-指定服务器/实例时出错) - Azure Web service Manage your accout link giving error: 26 - Error Locating Server/Instance Specified) SQL服务器错误(提供程序:SQL网络接口,错误:26-错误指定服务器/实例的位置) - SQL SERVER ERROR (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 错误:26-托管到Web服务器后定位服务器/实例时出错 - Error: 26 - Error Locating Server/Instance Specified after hosting to a web server SQL网络接口,错误:26-错误定位服务器/实例指定不使用SQL Server Express - SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified not using SQL Server Express 仅在调试时才出现SQL Server错误26(指定错误的服务器/实例) - SQL Server Error 26 (Error Locating Server/Instance Specified) Only When Debugging 错误。 SQL网络接口,错误:26-指定服务器/实例时出错 - Error. SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM