asp.net-mvc 如何修复 System.Net.Sockets.SocketException

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14021157/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 02:29:39  来源:igfitidea点击:

How to fix System.Net.Sockets.SocketException

asp.net-mvcwindows-server-2008

提问by Theomax

I'm working on an ASP.NET MVC website, it has been installed on three different servers (the same code version), it works on two of the servers i.e the user can login, but on one server after the user has submitted their username and password, the following server error is displayed in the browser:

我在一个 ASP.NET MVC 网站上工作,它已安装在三个不同的服务器上(相同的代码版本),它在两台服务器上工作,即用户可以登录,但在用户提交他们的服务器后在一台服务器上工作用户名和密码,浏览器显示如下服务器错误:

Security Exception

System.Security.SecurityException: Token not found

The event viewer for the environment the error is occuring on shows the following two error messages at the point where th euser attempts to login:

发生错误的环境的事件查看器在用户尝试登录时显示以下两条错误消息:

Could not init pool.
System.Net.Sockets.SocketException (0x80004005): 
A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because 
connected host has failed to respond (server ip address)

And this error:

而这个错误:

Error: System.Security.SecurityException: Token not found

Which is the server error displayed in the browser. This has in the past been resolved by deleting an authentication cookie, but that doesn't work for this error.

这是浏览器中显示的服务器错误。过去已通过删除身份验证 cookie 解决了此问题,但这不适用于此错误。

I have tried setting the trust level in the web.config to full which didn't work. I have tried restarting IIS.

我曾尝试将 web.config 中的信任级别设置为 full,但没有成功。我试过重新启动 IIS。

Has anyone else come accross a similar problem? Could this problem be caused because a service of some kind isn't running? Any suggestions will be appreciated.

有没有其他人遇到过类似的问题?这个问题可能是因为某种服务没有运行吗?任何建议将不胜感激。

采纳答案by Sharon Harvey

Most of the time these are connectivity timeouts due to different IP protocols (IPV4/IPV6) between the two server/computers trying to communicate or extra authentication rules setup on one of the computers for outgoing or incoming connectivity. Ways to troubleshoot the issue:

大多数情况下,由于两台服务器/计算机之间尝试通信的不同 IP 协议 (IPV4/IPV6) 或在其中一台计算机上为传出或传入连接设置额外的身份验证规则而导致连接超时。解决问题的方法:

  1. Review IIS logs
  2. Review EventLogs
  3. Try adjusting TCP/IP parameters in the registry to increase the time allowed to connect
  1. 查看 IIS 日志
  2. 查看事件日志
  3. 尝试调整注册表中的 TCP/IP 参数以增加允许连接的时间

http://msdn.microsoft.com/en-us/library/aa560610(d=printer,v=bts.20).aspx

http://msdn.microsoft.com/en-us/library/aa560610(d=printer,v=bts.20).aspx

Even though the above article references Windows 2003, I've discovered it applies to some 2008 environments.

尽管上面的文章引用了 Windows 2003,但我发现它适用于某些 2008 环境。

回答by Raj kumar

I was getting 0x80004005 & The requested name is valid, but no data of the requested type was found. My complete error

我得到 0x80004005 & 请求的名称有效,但未找到请求类型的数据。我的完整错误

Check You have proper internet connection are there on your machine or not. And you are able to ping the remote server or not. I solved by checking both.

检查您的机器上是否有正确的互联网连接。并且您是否能够 ping 远程服务器。我通过检查两者来解决。

回答by Ajay Munugala

We were getting this error when one of a third party API hosted on of our server(Azure) was not able to communicate with one of our web services on a different machine(iNetU). Options were to open ports so that these machines could talk or to move the web service to the machine hosting the third party API.

当我们的服务器 (Azure) 上托管的第三方 API 之一无法与另一台机器 (iNetU) 上的 Web 服务之一进行通信时,我们收到此错误。选项是打开端口,以便这些机器可以通信或将 Web 服务移动到托管第三方 API 的机器。