[英]How to connect to a Sql Server VM via private IP with Azure Website
I have an Azure VM with port 1433 endpoint created. 我有一个创建了端口1433终结点的Azure VM。 The internal IP is 110.119.38.72. 内部IP为110.119.38.72。
In my Azure Standard Website Web.Config connstring if have: 在我的Azure标准网站Web.Config中,如果具有:
Server=110.119.38.72;Database=MyDB;uid=username;pwd=password;
I am getting the error: 我收到错误消息:
[Win32Exception (0x80004005): Access is denied]
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server.
See screenshot for more details: 请参阅屏幕截图以获取更多详细信息:
If I change my connection string to the Public IP of my Azure Sql Server I am able to connection. 如果将连接字符串更改为Azure Sql Server的公用IP,则可以连接。
How can I used the Internal IP of my Sql Server VM in my Azure Website? 如何在Azure网站中使用Sql Server VM的内部IP?
By default you can't. 默认情况下不能。 However, Azure websites now support running on a Virtual Network, so (in theory) you should be able to create a vnet and place both your SQL Server vm and the Azure Website on that vnet. 但是,Azure网站现在支持在虚拟网络上运行,因此(理论上)您应该能够创建一个vnet,并将SQL Server虚拟机和Azure网站都放置在该vnet上。 That should enable you to connect to the db using the internal (vnet) ip address of the vm. 这应该使您能够使用虚拟机的内部(vnet)IP地址连接到数据库。 I haven't tried this tho, so no guarantees. 我还没有尝试过,所以不能保证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.