我在C#中遇到连接问题 [英] I have a connection problem in C#
问题描述
我是一个由六人组成的大学项目组,我们正在使用C#(使用Microsoft Visual Studio 2017作为IDE)制作一个可以管理啤酒生产系统的程序。
I有一个奇怪的问题,我不知道如何解决。每当我通过Visual Studio,尝试连接到任何类型的数据库或服务器时,我都会收到错误。
在我的项目组中,我们使用的是postgreSQL数据库,每当我尝试连接它时,我收到以下错误:
System.Net.SocketException(0x80004005):没有这样的主机是已知的
在System.Net .Dns.GetAddrInfo(String name)
在System.Net.Dns.InternalGetHostByname(String hostName,Boolean includeIPv6)
没有其他人在我的项目组中收到此错误,并且我尝试在Visual Studio中运行的所有应用程序问题仍然存在。如前所述,问题出现的不仅仅是数据库。我甚至无法连接到从朋友电脑上运行的简单服务器。
我的笔记本电脑使用Windows 10作为操作系统。
我尝试了什么:
我试过在我的另一台电脑上安装Visual Studio(桌面,也是Windows 10),同样的问题也出现了。
我已经尝试谷歌搜索解决方案几个小时没有结果。
我试过在两个不同的网络上运行程序,所以我排除了网络问题。
我也几乎排除了端口作为一个问题。我已尝试进入高级防火墙设置,制定规则打开程序中使用的端口。我已经尝试更改程序中使用的端口。
我确保Visual Studio可以通过两台PC上的防火墙访问。
I am in a university project group of six people, and we are using C# (with Microsoft Visual Studio 2017 as IDE) to make a program, that can manage a beer production system.
I have a weird problem that i have no idea how to fix. Whenever I through Visual Studio, try to connect to a database or a server of any kind, I get an error.
In my project group, we are using a postgreSQL databse, and whenever I try connecting to it, I get the following error:
System.Net.SocketException (0x80004005): No such host is known
at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByname(String hostName, Boolean includeIPv6)
No one else in my project group gets this error, and the problem persists with all applications I try to run in Visual Studio. As mentioned it is not just with databases the problem occurs. I can't even connect to a simple server being run from a friends pc.
My laptop uses Windows 10 as OS.
What I have tried:
I have tried installing Visual Studio on my other computer (a desktop, also Windows 10), and the same problem occurs.
I have tried googling for solutions for hours without result.
I have tried running the program on two different networks, so I have ruled out the network as a problem.
I have also pretty much ruled out the port as a problem. I have tried going to the advanced firewall settings, making a rule opening the port used in the program. I have tried changing the port used in the program.
I have made sure that Visual Studio has access through the firewall on both pc's.
推荐答案
您好,
您提供的信息不够复杂。你指的是几个问题。让我们一步一步前进。按照我的解决方案并留下评论我将根据您的进度阅读并更改/改进解决方案,直到我们解决它。好?
首先,请使用CMD并ping localhost我希望你能像这样重播:
Hi,
The information that you provided is not enough and to complicated. You are referring to several problems. Let`s make progress step-by-step. Follow my solution and leave comments I will read and change/improve the solution according to your progress until we get it solve. Ok?
So first, please use CMD and ping localhost I expect you get replay like this:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
2-确保你不要没有任何虚拟网卡,例如,如果您使用的是虚拟机,请尝试禁用其他适配器。
3-没有代理应该运行
4-将防火墙设置重置为默认值或者现在只需禁用它
5-确保你的防病毒不会与任何套接字/端口/接口大量接触
6-编写一个基于套接字的小应用程序,看看你是否能够启动并运行,非常简单。首先试试localhost然后去网络。
7-不要剪头发我们还有其他尝试只是发表评论。
顺便说一句,如果你想写评论请同时添加 ipconfig
的结果 - 如果你不是家人的话用 ipconfig
询问Mr.Google
祝你好运
AH
2- Make sure you don`t have any virtual NIC, for example if you are using virtual machine try to disable other adapters.
3- No proxy should be running
4- Reset your firewall settings to default or for now just disable it
5- Make sure your anti-virus does not mass up with any socket/port/interface
6- Write a small socket based application and see if you are able to make it up and running, something very simple. First try on localhost then go for network.
7- Do not cut your hairs we still do have some other tries just leave a comment.
Btw, if you wanted to write comment please also add results of ipconfig
-all if you are not families with ipconfig
ask Mr.Google
Good luck
AH
这篇关于我在C#中遇到连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!