Can't access web service when connected to the network :: HTTP 407

心已入冬 提交于 2019-12-23 03:34:16

问题


I have a console application that communicates with a web service. Both of them are on the same machine.

When I am accessing the web service with the LAN disabled, it connects without a problem. But if the LAN is enabled and connected to our office network, I receive this error:

"HTTP 407 Proxy Authentication required - The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied."

We've been hunting the source of the problem for three days now. We have tried everything that we can think of. Any ideas what's causing the problem?

Additional notes: - The machine is in a Workgroup setup but with DNS suffix (computer.local). When accessing the web service, we type the address as "http://machine.computer.local/service.asmx"

  • I talked to the IT guys and they said that we don't have an ISA server installed

  • There is no "proxy" set in IE.

  • The machine is in mint condition.


回答1:


Apparently, the IT guys that I've talked with is not aware of the corporate-wide ISA server.

Using Wireshark, I dumped the data to an HTML file (a standard HTTP 407 error page). It clearly showed the Hostname and IP address of the ISA server.

In short, the problem is the ISA server. Although it is still a mystery on why the machine would contact the ISA server if the IIS server hosting the site is located on the machine itself (localhost).

Workaround: Use the bypassonlocal property.

<configuration>
   <system.net>
      <defaultProxy>
         <proxy proxyaddress="<ISA-SERVER>" bypassonlocal="true"/>
      </defaultProxy>
   </system.net>
</configuration>



回答2:


Try adding the following line to your hosts file:

127.0.0.1 machine.computer.local



回答3:


Under "configuration" section in Web.config add this:

 <system.net>
   <defaultProxy enabled="true" useDefaultCredentials="true"></defaultProxy>
 </system.net>

Then works like a charm!



来源:https://stackoverflow.com/questions/2286801/cant-access-web-service-when-connected-to-the-network-http-407

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!