Question

I'm really struggling to know what the problem is here...

I have 2 websites configured in IIS...

**PH.Website**   (STANDARD MVC PROJECT)

**PH.Api**       (MVC WEB API PRIOJECT)

When you hit the PH.Website it uses a WebClient class in one of the controllers to download data from the PH.Api. However fiddler only sees traffic going to the PH.Website not the PH.Api.

After reading around on the internet I apparently have to do some configuration of the Syste.Net in the Web Api Project. So I added...

  <system.net>
    <defaultProxy>
      <proxy
              usesystemdefault="False"
              bypassonlocal="True"
              proxyaddress="http://PH.Api"
              />
    </defaultProxy>
  </system.net>

But still no luck. I know the request is happening I just cant see it.

Whats even more confusing is when I configure Fiddler to use Port 80 its says it cannot listen on that port. But hang on if it cant listen on 80 then how the hell can it see traffic on the Http port:80 anyway?

P.s. I really need to be able to run multiple sites locally so. I hate running sites under Localhost or 127.0.0.1 seems so silly when you can create seperate sites for everything in IIS and know exactly where everything maps....

Was it helpful?

Solution

Let's back up.

Fiddler's a proxy server; it sees all of the traffic that is sent to it. Generally speaking (unless you're using it as a Reverse Proxy) you never want to configure Fiddler to run on port 80; instead leave it up at port 8888 where it runs by default. You instead configure your client to proxy its traffic through Fiddler.

Now, what "reading around on the Internet" did you do that caused you to modify your machine.config or web.config file (you didn't mention which you edited)?

If your goal is to watch traffic with Fiddler, you need to point the ASP.NET proxy settings at Fiddler, not at whatever "PH.api" is (e.g. use "127.0.0.1:8888" and set bypassOnLocal to false). The further complexity arises in that System.NET bypasses the proxy for any request to "localhost" or "127.0.0.1", so if you're using those addresses for your target, you should change them to "localhost.fiddler" temporarily while debugging.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top