简体   繁体   English

Azure Web 应用程序错误,未知此类主机

[英]Azure Web App Error, No such host is known

When Running the web App locally there is no issue to connect to the DB,在本地运行 web 应用程序时,连接到数据库没有问题,

after deploying the Web App to Azure the DB(Also Azure) connection attempt throws the following error:将 Web 应用程序部署到 Azure 后,DB(Also Azure) 连接尝试引发以下错误:

[Win32Exception (0x80004005): No such host is known]

[SqlException (0x80131904): 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 - No such host is known.)]

The DB FW Settings: Allow access to Azure services: is set ON DB FW 设置:允许访问 Azure 服务:设置为 ON

Any Idea on how I can trouble shoot/ Resolve this issue?关于如何排除故障/解决此问题的任何想法?

Make sure you don't override connection string in portal config确保您没有覆盖门户配置中的连接字符串在此处输入图片说明

This could be caused by pasting your connection string in after Data Source=这可能是由于在Data Source=之后粘贴您的连接字符串引起的

connectionString="Data Source=Server=...."

Instead, it should be相反,它应该是

connectionString="Server=...."  

Could you ensure that: 1) Remote connections are allowed to the SQL Server.您能否确保:1)允许远程连接到 SQL Server。 - You did that, so it is OK. - 你这样做了,所以没关系。

2) Use the full name of the server you are connecting to (myserver.database.windows.net) not something else. 2) 使用您要连接的服务器的全名 (myserver.database.windows.net) 而不是其他名称。

Did you try to connect to it from your local computer using SQL Server Management Studio?您是否尝试使用 SQL Server Management Studio 从本地计算机连接到它? If so, and if server authentication is set to SQL Server and Windows Authentication and it works, then please paste the details as David suggested and we will try to troubleshoot (actually, with SQL Azure there is not so much to troubleshoot), or try to ask technical support.如果是这样,并且如果服务器身份验证设置为 SQL Server 和 Windows 身份验证并且可以正常工作,那么请按照 David 建议粘贴详细信息,我们将尝试进行故障排除(实际上,使用 SQL Azure 没有太多需要排除的故障),或者尝试寻求技术支持。

Worked yesterday, stopped working today.昨天上班,今天停工。 Redeployed my app and it started working again.重新部署了我的应用程序,它又开始工作了。

[![在我的情况下,我不知道如何在虚拟网络和防火墙选项中按下红色选项我打开以允许 azure 服务可以连接 sql server,它成功了][1]][1]

I had the exact same situation:我有完全相同的情况:

This happened to me:这发生在我身上:

  1. I created a database in Azure, using a bacpac from a blob我在 Azure 中创建了一个数据库,使用 blob 中的 bacpac
  2. I deployed my web app to azurewebsites.net我将我的 Web 应用程序部署到 azurewebsites.net
  3. Running my web app in localhost it connects successfully to the new database在 localhost 中运行我的 Web 应用程序,它成功连接到新数据库
  4. Running my web app in azurewebsites.net it throwed: No such host is known在 azurewebsites.net 中运行我的网络应用程序它抛出: No such host is known

I tried many things but at the end I think it solved by itself (maybe it was a cache problem).我尝试了很多东西,但最后我认为它自己解决了(可能是缓存问题)。

Try deleting your web.config using FTP and reuploading it.尝试使用 FTP 删除您的 web.config 并重新上传。

I fixed this issue replacing the connection string in my code.我解决了这个问题,替换了我的代码中的连接字符串。

The correct connectionstring for mysql, the port is splited from the host, like: mysql 的正确连接字符串,端口与主机分离,如:

Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword

check it out in: https://www.connectionstrings.com/mysql/查看: https : //www.connectionstrings.com/mysql/

I was missing Service Bus connection, that can be found below:我缺少服务总线连接,可以在下面找到:

Azure Function > Integrate > Outputs > Azure Service Bus > Service Bus connection Azure 功能 > 集成 > 输出 > Azure 服务总线 > 服务总线连接

Last two may be something else for you.最后两个对你来说可能是别的东西。

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

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