windows-8 – 如何在Windows 8.1(IE11和Modern UI)上调试PAC(代理自动配置)?

前端之家收集整理的这篇文章主要介绍了windows-8 – 如何在Windows 8.1(IE11和Modern UI)上调试PAC(代理自动配置)?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在较旧的系统(如 Windows 7 IE10)上,在PAC文件调用“alert()”会导致显示对话框.但是,在Windows 8.1中,即使IE11似乎正在使用PAC,也不会显示任何对话框.

我目前的情况是IE11可以使用(SOCKS)代理(由PAC返回)就好了,但现代UI应用程序与Internet完全断开连接.似乎IE11和Modern UI对PAC设置的处理方式不同,但我找不到调试它的方法.

总之,我的问题是

>如何在Windows 8.1上使用IE11调试PAC?
>如何在Windows 8.1上使用Modern UI调试PAC?

IE11 PAC文件更改

Microsoft对IE11如何处理本地PAC文件进行了更改.你可以阅读它们here或参见下面的一些快速信息.

另请注意,alert()语句不再适用于Windows 8.

With IE11,the usage of a PAC-file through the file-protocol is no
more possible,unless you add the following registry-key:

  1. [HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings]
  2. (DWORD)"EnableLegacyAutoProxyFeatures"=1

Note: alert-statements will no more appear when using Windows 8 or
higher!

使用AUTOPROX的DEBUG PAC文件(Download Link)

Sometimes you need just to test your PAC-file,if the expected route
is returned,although you have no access to the website in question.
For such testing you can use the (attached) command line-utility tool
autoprox.exe,created by Pierre-Louis Coll.

When starting it in a CMD without additional parameter the usage is
displayed:

  1. C:\temp>autoprox
  2. Version : 2.1.0.0
  3. Written by pierrelc@microsoft.com
  4. Usage : AUTOPROX -s (calling DetectAutoProxyUrl and saving wpad.dat file in temporary file)
  5. Usage : AUTOPROX [-h] url [Path to autoproxy file]
  6. -h: calls InternetInitializeAutoProxyDll with helper functions implemented in AUTOPROX
  7. AUTOPROX url: calling DetectAutoProxyUrl and using WPAD.DAT logic to find the proxy for the url
  8. AUTOPROX url path: using the autoproxy file from the path to find proxy for the url
  9. Example: autoprox -s
  10. Example: autoprox http://www.microsoft.com
  11. Example: autoprox -h http://www.microsoft.com c:\inetpub\wwwroot\wpad.dat
  12. Example: autoprox http://www.microsoft.com http://proxy/wpad.dat

Here is the output with our sample:

  1. C:\temp>autoprox http://us.msn.com c:\temp\sample.pac
  2. The Winsock 2.2 dll was found okay
  3. url: http://us.msn.com
  4. autoproxy file path is : c:\temp\sample.pac
  5. Calling InternetInitializeAutoProxyDll with c:\temp\sample.pac
  6. Calling InternetGetProxyInfo with url http://us.msn.com and host us.msn.com
  7. Proxy returned for url http://us.msn.com is:
  8. PROXY myproxy:80;

When you want to see which DNS-related functions have been called,you can use the parameter “-h” in addition: Here the output,when
this is used:

  1. C:\temp>autoprox -h http://us.msn.com c:\temp\sample.pac
  2. The Winsock 2.2 dll was found okay
  3. Will call InternetInitializeAutoProxyDll with helper functions
  4. url: http://us.msn.com
  5. autoproxy file path is : c:\temp\sample.pac
  6. Calling InternetInitializeAutoProxyDll with c:\temp\sample.pac
  7. Calling InternetGetProxyInfo with url http://us.msn.com and host us.msn.com
  8. ResolveHostByName called with lpszHostName: us.msn.com
  9. ResolveHostByName returning lpszIPAddress: 65.55.206.229
  10. Proxy returned for url http://us.msn.com is:
  11. PROXY myproxy:80;

Error-Handling in autoprox.exe:

  1. When you specify a non-existing PAC-file (e.g. typo in the command-line),the result from autoprox.exe will be:

    ERROR: InternetInitializeAutoProxyDll Failed with error number 0x6 6.

  2. When the Pac-file contains Syntax-errors,you typically receive the following message displayed:

    ERROR: InternetGetProxyInfo Failed with error number 0x3eb 1003.

After finishing the local test,the PAC-file should be copied to the webserver where it will be accessed through http-protocol.

猜你在找的Windows相关文章