[英]How can I force VM's to use the host proxy settings from C#?
I have various types of VM's running that I'd like to use my local machine's proxy settings. 我有多种类型的VM正在运行,我想使用本地计算机的代理设置。 This way any browser activity from the VM would go through the host proxy even if the VM's proxy settings are turned off.
这样,即使VM的代理设置已关闭,来自VM的任何浏览器活动都将通过主机代理。 But they seem to ignore the settings and just go straight out to the internet bypassing the proxy.
但是他们似乎忽略了设置,只是绕过代理直接进入了互联网。
I have a WinInet settings being setup via winhttp.dll and wininet.dll external calls. 我通过winhttp.dll和wininet.dll外部调用设置了WinInet设置。 But I'm not able to find the magic answer to getting the VM's to go through the proxy instead of bypassing.
但我无法找到让VM通过代理而不是绕过的神奇答案。
Help? 救命?
I've had luck with the following reg hack for 32bit: 我对以下32位的reg hack感到很幸运:
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 0x1 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0x1 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d myproxy.local:3128 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d ^<local^>; /f
REG ADD "HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 0x0 /f
For 64bit I've had less luck, but this works for browsers. 对于64位,我运气较差,但这适用于浏览器。 :
:
REG ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 0x1 /f
REG ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0x1 /f
REG ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d myproxy.local:3128 /f
REG ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d ^<local^>; /f
REG ADD "HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 0x0 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 0x1 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0x1 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d myproxy.local:3128 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d ^<local^>; /f
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.