如何从身份验证代理后面运行 svcutil.exe [英] How to run svcutil.exe from behind authenticating proxy
问题描述
我想运行 svcutil.exe
工具来访问 Internet 上的 Web 服务.不幸的是,每当我尝试时,都会收到一堆错误,其中包含以下消息:
I want to run the svcutil.exe
tool to access a web service on the internet. Unfortunately, whenever I try, I get a bunch of errors that include the following message:
请求失败,HTTP 状态为 407:需要代理身份验证(ISA 服务器需要授权才能完成请求.对 Web 代理过滤器的访问被拒绝.
The request failed with HTTP status 407: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied.
正如我从 这篇相关帖子 中了解到的(使用 更多细节在这里),问题是我坐在一个身份验证代理后面.那篇文章解释说我需要编辑 app.config
文件,但我不知道该怎么做.我想我将使用 /svcutilConfig:alternate_app.config
开关,但我不知道如何构造一个有效的 .config 文件来传递给该开关.svcutil.exe 使用的默认 app.config 文件是什么?
As I have learned from this related post (with more details here), the problem is that I am sitting behind an authenticating proxy. That post explains that I need to edit the app.config
file, but I can't figure out how to do that. I think I will use the /svcutilConfig:alternate_app.config
switch, but I don't know how to construct a valid .config file to pass to that switch. What is the default app.config file that svcutil.exe uses?
推荐答案
好吧,我想我已经找到了问题的答案:
Well, I think I have figured out the answer to my question:
事实证明,svcutil.exe
使用的默认 .config
文件名为 svcutil.exe.config
,并且(至少对我来说)它位于这个文件夹中:
It turns out that the default .config
file used by svcutil.exe
is called svcutil.exe.config
, and (at least for me) it lives in this folder:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin
我决定直接编辑该文件(而不是通过 /svcutilConfig
开关摸索).我需要管理员权限才能这样做.
I decided to just edit that file directly (rather than fumble around with the /svcutilConfig
switch). I needed Admin privileges to do so.
该文件的最终内容如下所示:
The final contents of that file looked like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<generatePublisherEvidence enabled="false" />
</runtime>
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>
</configuration>
(隐藏在
元素中的秘诀.)
(with the secret sauce buried in the <system.net>
element.)
为了让这一切正常工作,我必须以管理员身份启动命令提示符,导航到上面列出的文件夹,然后从那里运行 svcutil.exe 命令.
In order for this all to work, I had to start the Command Prompt as Administrator, navigate to the folder listed above, and run the svcutil.exe command from there.
希望这能帮助其他陷入困境的可怜人!感谢@AndrewWebb 为我提供线索!
Hope this helps some other poor soul who gets stuck in this mess! Thanks to @AndrewWebb for the clues that got me going!
这篇关于如何从身份验证代理后面运行 svcutil.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!