V2rayn: An attempt was made to access a socket in a way forbidden by its access permissions.

Created on 28 Apr 2020  ·  4Comments  ·  Source: 2dust/v2rayN

在提出问题前请先自行排除服务器端问题和升级到最新客户端,同时也请通过搜索确认是否有人提出过相同问题。

预期行为

描述你认为应该发生什么

实际行为

描述实际发生了什么

复现方法

1.
2.
3.

日志信息,位置在当前目录下的guiLogs



--------------------------------info[10:54:59]--------------------------------
System.Exception: v2rayN start up v2rayN - V3.5 - 2020/01/15

--------------------------------进程已退出,因此无法获得所请求的信息。[12:44:36]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------进程已退出,因此无法获得所请求的信息。[12:44:58]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------进程已退出,因此无法获得所请求的信息。[12:44:58]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.HttpProxyHandler.PrivoxyHandler.KillProcess(Process p)

--------------------------------info[12:45:04]--------------------------------
System.Exception: v2rayN start up v2rayN - V3.5 - 2020/01/15

--------------------------------进程已退出,因此无法获得所请求的信息。[12:45:17]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.HttpProxyHandler.PrivoxyHandler.KillProcess(Process p)

--------------------------------进程已退出,因此无法获得所请求的信息。[12:54:23]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------无法连接到远程服务器[12:54:26]--------------------------------
System.Net.WebException: 无法连接到远程服务器 ---> System.Net.Sockets.SocketException: 由于目标计算机积极拒绝,无法连接。 127.0.0.1:10809
在 System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
在 System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
在 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- 内部异常堆栈跟踪的结尾 ---
在 System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
在 v2rayN.Handler.DownloadHandle.OnResponseV2rayN(IAsyncResult ar)

--------------------------------进程已退出,因此无法获得所请求的信息。[12:54:34]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.HttpProxyHandler.PrivoxyHandler.KillProcess(Process p)

--------------------------------info[12:54:42]--------------------------------
System.Exception: Webserver prefixes http://*:10810/pac/

--------------------------------另一个程序正在使用此文件,进程无法访问。[12:54:43]--------------------------------
System.Net.HttpListenerException (0x80004005): 另一个程序正在使用此文件,进程无法访问。
在 System.Net.HttpListener.AddAllPrefixes()
在 System.Net.HttpListener.Start()
在 v2rayN.Base.HttpWebServer..ctor(String[] prefixes, Func`2 method)

--------------------------------info[12:54:43]--------------------------------
System.Exception: Webserver InitServer 另一个程序正在使用此文件,进程无法访问。

--------------------------------info[12:54:43]--------------------------------
System.Exception: WebserverB at 127.0.0.1

--------------------------------CurrentDomain_UnhandledException[12:54:43]--------------------------------
System.Net.Sockets.SocketException (0x80004005): 以一种访问权限不允许的方式做了一个访问套接字的尝试。
在 System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
在 System.Net.Sockets.Socket.Bind(EndPoint localEP)
在 System.Net.Sockets.TcpListener.Start(Int32 backlog)
在 v2rayN.Base.HttpWebServerB.StartListen()
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()

--------------------------------info[12:55:09]--------------------------------
System.Exception: v2rayN start up v2rayN - V3.5 - 2020/01/15

--------------------------------info[12:55:12]--------------------------------
System.Exception: Webserver prefixes http://*:10810/pac/

--------------------------------另一个程序正在使用此文件,进程无法访问。[12:55:12]--------------------------------
System.Net.HttpListenerException (0x80004005): 另一个程序正在使用此文件,进程无法访问。
在 System.Net.HttpListener.AddAllPrefixes()
在 System.Net.HttpListener.Start()
在 v2rayN.Base.HttpWebServer..ctor(String[] prefixes, Func`2 method)

--------------------------------info[12:55:12]--------------------------------
System.Exception: Webserver InitServer 另一个程序正在使用此文件,进程无法访问。

--------------------------------info[12:55:12]--------------------------------
System.Exception: WebserverB at 127.0.0.1

--------------------------------info[12:56:01]--------------------------------
System.Exception: v2rayN start up v2rayN - V3.5 - 2020/01/15

--------------------------------info[12:56:03]--------------------------------
System.Exception: Webserver prefixes http://*:10810/pac/

--------------------------------另一个程序正在使用此文件,进程无法访问。[12:56:03]--------------------------------
System.Net.HttpListenerException (0x80004005): 另一个程序正在使用此文件,进程无法访问。
在 System.Net.HttpListener.AddAllPrefixes()
在 System.Net.HttpListener.Start()
在 v2rayN.Base.HttpWebServer..ctor(String[] prefixes, Func`2 method)

--------------------------------info[12:56:03]--------------------------------
System.Exception: Webserver InitServer 另一个程序正在使用此文件,进程无法访问。

--------------------------------info[12:56:03]--------------------------------
System.Exception: WebserverB at 127.0.0.1

--------------------------------info[12:57:49]--------------------------------
System.Exception: v2rayN start up v2rayN - V3.5 - 2020/01/15

--------------------------------info[12:57:51]--------------------------------
System.Exception: Webserver prefixes http://*:10810/pac/

--------------------------------另一个程序正在使用此文件,进程无法访问。[12:57:51]--------------------------------
System.Net.HttpListenerException (0x80004005): 另一个程序正在使用此文件,进程无法访问。
在 System.Net.HttpListener.AddAllPrefixes()
在 System.Net.HttpListener.Start()
在 v2rayN.Base.HttpWebServer..ctor(String[] prefixes, Func`2 method)

--------------------------------info[12:57:51]--------------------------------
System.Exception: Webserver InitServer 另一个程序正在使用此文件,进程无法访问。

--------------------------------info[12:57:51]--------------------------------
System.Exception: WebserverB at 127.0.0.1

--------------------------------info[13:01:14]--------------------------------
System.Exception: v2rayN start up v2rayN - V3.5 - 2020/01/15

--------------------------------info[13:01:16]--------------------------------
System.Exception: Webserver prefixes http://*:10810/pac/

--------------------------------另一个程序正在使用此文件,进程无法访问。[13:01:16]--------------------------------
System.Net.HttpListenerException (0x80004005): 另一个程序正在使用此文件,进程无法访问。
在 System.Net.HttpListener.AddAllPrefixes()
在 System.Net.HttpListener.Start()
在 v2rayN.Base.HttpWebServer..ctor(String[] prefixes, Func`2 method)

--------------------------------info[13:01:16]--------------------------------
System.Exception: Webserver InitServer 另一个程序正在使用此文件,进程无法访问。

--------------------------------info[13:01:16]--------------------------------
System.Exception: WebserverB at 127.0.0.1

--------------------------------info[13:12:51]--------------------------------
System.Exception: v2rayN start up v2rayN - V3.18 - 2020/04/23

--------------------------------info[13:12:56]--------------------------------
System.Exception: Webserver prefixes http://*:10810/pac/

--------------------------------另一个程序正在使用此文件,进程无法访问。[13:12:56]--------------------------------
System.Net.HttpListenerException (0x80004005): 另一个程序正在使用此文件,进程无法访问。
在 System.Net.HttpListener.AddAllPrefixes()
在 System.Net.HttpListener.Start()
在 v2rayN.Base.HttpWebServer..ctor(String[] prefixes, Func`2 method)

--------------------------------info[13:12:56]--------------------------------
System.Exception: Webserver InitServer 另一个程序正在使用此文件,进程无法访问。

--------------------------------info[13:12:56]--------------------------------
System.Exception: WebserverB at 127.0.0.1

--------------------------------进程已退出,因此无法获得所请求的信息。[13:13:56]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------2020/04/28 13:13:58 Using default config: C:v2rayN-Coreconfig.json
[13:13:58]--------------------------------
System.Exception: 2020/04/28 13:13:58 Using default config: C:v2rayN-Coreconfig.json

在 v2rayN.Handler.V2rayHandler.V2rayStart()

--------------------------------进程已退出,因此无法获得所请求的信息。[13:14:17]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------2020/04/28 13:14:17 Using default config: C:v2rayN-Coreconfig.json
[13:14:17]--------------------------------
System.Exception: 2020/04/28 13:14:17 Using default config: C:v2rayN-Coreconfig.json

在 v2rayN.Handler.V2rayHandler.V2rayStart()

--------------------------------进程已退出,因此无法获得所请求的信息。[13:17:11]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------2020/04/28 13:17:11 Using default config: C:v2rayN-Coreconfig.json
[13:17:12]--------------------------------
System.Exception: 2020/04/28 13:17:11 Using default config: C:v2rayN-Coreconfig.json

在 v2rayN.Handler.V2rayHandler.V2rayStart()

--------------------------------进程已退出,因此无法获得所请求的信息。[13:18:13]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------2020/04/28 13:18:13 Using default config: C:v2rayN-Coreconfig.json
[13:18:13]--------------------------------
System.Exception: 2020/04/28 13:18:13 Using default config: C:v2rayN-Coreconfig.json

在 v2rayN.Handler.V2rayHandler.V2rayStart()

--------------------------------进程已退出,因此无法获得所请求的信息。[13:19:07]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------2020/04/28 13:19:07 Using default config: C:v2rayN-Coreconfig.json
[13:19:07]--------------------------------
System.Exception: 2020/04/28 13:19:07 Using default config: C:v2rayN-Coreconfig.json

在 v2rayN.Handler.V2rayHandler.V2rayStart()

--------------------------------进程已退出,因此无法获得所请求的信息。[13:20:27]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------info[13:25:08]--------------------------------
System.Exception: v2rayN start up v2rayN - V3.18 - 2020/04/23

--------------------------------2020/04/28 13:25:13 Using default config: C:v2rayN-Coreconfig.json
[13:25:13]--------------------------------
System.Exception: 2020/04/28 13:25:13 Using default config: C:v2rayN-Coreconfig.json

在 v2rayN.Handler.V2rayHandler.V2rayStart()

--------------------------------进程已退出,因此无法获得所请求的信息。[13:25:36]--------------------------------
System.InvalidOperationException: 进程已退出,因此无法获得所请求的信息。
在 System.Diagnostics.Process.EnsureState(State state)
在 System.Diagnostics.Process.get_MainWindowHandle()
在 System.Diagnostics.Process.CloseMainWindow()
在 v2rayN.Handler.V2rayHandler.KillProcess(Process p)

--------------------------------2020/04/28 13:25:37 Using default config: C:v2rayN-Coreconfig.json
[13:25:37]--------------------------------
System.Exception: 2020/04/28 13:25:37 Using default config: C:v2rayN-Coreconfig.json

在 v2rayN.Handler.V2rayHandler.V2rayStart()

环境信息(客户端请升级至最新正式版)

yes

额外信息(可选)

null

Most helpful comment

似乎是 2004 更新后(可能是 Hyper-V)增加了一些系统保留端口,通过 netsh interface ipv4 show excludedportrange protocol=tcp 可以查询,每次重启都有可能是不同的端口

All 4 comments

似乎是 2004 更新后(可能是 Hyper-V)增加了一些系统保留端口,通过 netsh interface ipv4 show excludedportrange protocol=tcp 可以查询,每次重启都有可能是不同的端口

重启后问题自动消失,原因还是不明

我试了下@zry98的命令行,我的端口设置的确在范围内,更改了一个端口号就可以了

shadowsocks/shadowsocks-windows#1835

简单来说是 Hyper-V 的问题。关了 Hyper-V 再重启或者换一个不在范围内的端口就好了。
如果不想关 Hyper-V 又不想换端口,可以先禁用 Hyper-V,重启,将所需要的端口给抢先 exclude 掉,再打开 Hyper-V 即可。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ggshuini picture ggshuini  ·  4Comments

fishbol picture fishbol  ·  4Comments

4SM picture 4SM  ·  6Comments

willaytoun picture willaytoun  ·  7Comments

hhr-hhr picture hhr-hhr  ·  9Comments