如何在Windows 8.1(IE11和现代用户界面)上debuggingPAC(代理自动configuration)?

在Windows 7 + IE10等较早的系统中,在PAC文件中调用“alert()”会导致显示对话框。 但是,对于Windows 8.1,即使IE11似乎正在使用PAC,也不会显示对话框。

我目前的情况是IE11可以使用(SOCKS)代理(由PAC返回),但是现代UI应用与Internet完全断开。 看来IE11和Modern UI对待PAC的设置不同,但我找不到debugging的方法。

总之,我的问题是

  1. 如何在Windows 8.1上用IE11debuggingPAC?
  2. 如何在Windows 8.1上使用Modern UIdebuggingPAC?

    IE11 PAC文件更改

    微软已经改变了IE11如何处理本地PAC文件。 你可以在这里阅读关于他们或在下面看到一些快速信息。

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


    使用IE11,通过文件协议不能使用PAC文件,除非添加以下registry项:

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

    PAC文件通过文件协议的例子

    注意:使用Windows 8或更高版本时,警告语句将不再显示!


    DEBUG PAC文件与AUTOPROX ( 下载链接 )

    有时你只需要testing你的PAC文件,如果预期的路线被返回,虽然你没有访问有问题的网站。 对于这样的testing,您可以使用由Pierre-Louis Coll创build的(附加的)命令行实用工具autoprox.exe。

    在没有附加参数的情况下在CMD启动时,显示用法:

     C:\temp>autoprox Version : 2.1.0.0 Written by [email protected] Usage : AUTOPROX -s (calling DetectAutoProxyUrl and saving wpad.dat file in temporary file) Usage : AUTOPROX [-h] url [Path to autoproxy file] -h: calls InternetInitializeAutoProxyDll with helper functions implemented in AUTOPROX AUTOPROX url: calling DetectAutoProxyUrl and using WPAD.DAT logic to find the proxy for the url AUTOPROX url path: using the autoproxy file from the path to find proxy for the url Example: autoprox -s Example: autoprox http://www.microsoft.com Example: autoprox -h http://www.microsoft.com c:\inetpub\wwwroot\wpad.dat Example: autoprox http://www.microsoft.com http://proxy/wpad.dat 

    以下是我们示例的输出:

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

    当您想要查看哪些与DNS相关的function已被调用时,您可以使用参数“-h”:此处输出:

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

    autoprox.exe中的error handling:

    1. 当你指定一个不存在的PAC文件时(例如命令行中的错字),autoprox.exe的结果是:

      ERROR: InternetInitializeAutoProxyDll failed with error number 0x6 6.

    2. 当Pac文件包含语法错误时,通常会收到以下显示的消息:

      ERROR: InternetGetProxyInfo failed with error number 0x3eb 1003.

    完成本地testing后,PAC文件应该被复制到networking服务器,在那里它将通过http协议被访问。