免责声明:网站内容仅供个人学习记录,禁做商业用途,转载请注明出处。

版权所有 © 2017-2020 NEUSNCP个人学习笔记 辽ICP备17017855号-2

hyper-v 启用后,pycharm无法启动,以及其他软件端口绑定报错

JinLonghua    2020年7月30日 21:35:55

hyper-v启用后会自动保留端口,使一些应用无法申请到端口,运行错误
解决方案:
排除对应的使用端口 https://github.com/docker/for-win/issues/3171

@veqryn the workaround worked for me, the steps are:

  1. Disable hyper-v (which will required a couple of restarts)
    dism.exe /Online /Disable-Feature:Microsoft-Hyper-V

  2. When you finish all the required restarts, reserve the port you want so hyper-v doesn't reserve it back
    netsh int ipv4 add excludedportrange protocol=tcp startport=50051 numberofports=1

  3. Re-Enable hyper-V (which will require a couple of restart)
    dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

when your system is back, you will be able to bind to that port successfully.

查看是否成功排除  https://github.com/googlevr/gvr-unity-sdk/issues/1002

The reserved port changes as follows and InstantPreview will work.

C:\WINDOWS\system32>netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port    End Port
----------    --------  
     49687       49786  
     49838       49838     *  
     49839       49938  
     49939       50038  
     50039       50138  
     50139       50238  
* - Administered port exclusions.

固定保留端口(本人尝试似乎不太行)
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004973960-Critical-Internal-Error-on-Startup-of-IntelliJ-IDEA-Cannot-Lock-System-Folders-?page=1#community_comment_360001512800

 

Run the following commands to reset the dynamic port range to what it should be and reboot - this should fix things until Windows messes up the dynamic port range again. This is only for ipv4. I haven't looked at ipv6, but I'd assume it's similar.

netsh int ipv4 set dynamicport tcp start=49152 num=16383
netsh int ipv4 set dynamicport udp start=49152 num=16383

 



另外 hyper-v 启动与关闭命令 https://github.com/docker/for-win/issues/6689, https://www.poweronplatforms.com/enable-disable-hyper-v-windows-10-8/

Enable Hyper V - You can do this by running the following command as administrator. - dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

Enable Hypervisor with following command - bcdedit /set hypervisorlaunchtype auto
https://www.poweronplatforms.com/enable-disable-hyper-v-windows-10-8/
Option 2 – To Enable and Disable Hyper-V in PowerShell

1. Open an elevated PowerShell, and do step 2 or 3 below for what you want to do.

2. To Enable Hyper-V

A) In the elevated PowerShell window, copy and paste the command below, press Enter, and go to step 4 below. Note, If you do not use the -All switch, then you will not install the Hyper-V GUI Management Tools and Hyper-V Module for Windows PowerShell features.

 

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All

3. To Disable Hyper-V

A) In the elevated PowerShell window, copy and paste the command below, press Enter, and go to step 4 below.

 

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

4. Type Y and press Enter when prompted to restart the computer.

最近更新: 2020年7月31日 12:05:00
浏览: 1.8K

[[total]] 条评论

添加评论
  1. [[item.time]]
    [[item.user.username]] [[item.floor]]楼
  2. 点击加载更多……
  3. 添加评论