ASP.net4 SQL连接问题

发布于 2024-12-04 05:05:57 字数 751 浏览 0 评论 0原文

好的,首先介绍一些背景知识:

我家里有 2 台服务器,其中 1 台运行 Web 服务器,而另一台几乎是数据服务器。

这两台服务器都有 2 个千兆 LAN 端口。 两台服务器上的 LAN 端口 1 直接连接到互联网。 而 Lan 端口 2 将两者连接在一起。 (参见示意图:示意图 http://www.swan10.nl/stuff/schematic.png

当我关闭其中一台计算机上的互联网连接时,一切正常,但是当我在这两台计算机上打开互联网连接时,Web 服务器尝试通过互联网连接获取其数据,但我。不允许通过互联网看到 SQL 服务器。

现在我想知道是否可以告诉 Web 服务器使用哪个连接,因为我需要这两个设备都有独立的互联网访问权限,所以告诉 Web 服务器。仅使用连接 1(互联网)进行互联网连接,仅使用连接 2(链接)连接到 SQL 服务器/数据服务器

两台计算机都有自己的静态公共 WAN IP,它们直接连接到互联网,它们也是直接相连,中间没有路由器到目前为止,当我使 SQL 服务器在互联网上可见时,我才设法使其工作,这不是我想要的。

任何有关此问题的帮助将不胜感激,提前谢谢您。

ADD:

我已经尝试过互联网上发布的各种答案,我也尝试看看SQL服务器是否真的在监听它,如果两者都独立连接到互联网,它只是使用错误的连接和彼此。

Okay, some background first:

I have 2 servers at home, 1 of them runs the Webserver, while the other one is pretty much a data server.

Both of these servers have 2 Gigabit lan ports.
Lan port 1 on both servers are directly connected to the internet.
while Lan port 2 is connecting the two of them together.
(See Schematic: Schematic http://www.swan10.nl/stuff/schematic.png

This works all perfectly fine when I turn the internet connection off on one of these machines. However when I turn the internet connection on on both of these machines the Web server tries to obtain it's data through the internet connection, but I don't allow the SQL server to be seen over the internet.

Now I was wondering if it is possible to tell the Web server which connection to use, because I need both of these devices to have an independent internet access. So telling the Webserver to use connection 1 (internet) for just the internet connections, and use Connection 2 (link) solely to connect to the SQL server/Data Server

Both computers have their own static public WAN IP they are directly connected to the internet, they are also directly connected to each other, there is no router in-between them. So far i only managed to make it work when i made the SQL server visible to the internet which is not what I want.

Any help regarding this would be very much appreciated, thank you in advance.

ADD:

I have already tried various answers posted on the internet, I also tried and see if the SQL server is actually listening which it is, it just uses the wrong connection if both are connected independantly to the internet and to each other.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尤怨 2024-12-11 05:05:57

使用上述设置时,请确保在连接字符串中使用 IP 而不是服务器名称。

感谢“Paige Cook”刷新了我的记忆,并为我提供了我自己的答案!

Make sure you use IP instead of Server Name in the connection string when using mentioned set up.

Thank you "Paige Cook" for refreshing my memory, and pretty much supplying me with my own answer!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文