capturing traffic originating from console app and vstudio iis express http://localhost:<port>/

1,024 views
Skip to first unread message

robertob

unread,
May 13, 2015, 9:26:14 PM5/13/15
to httpf...@googlegroups.com
when I run fiddler to capture traffic originating from console app and vs15rc [ or vs13upd4 ] f5 debug/test initiated iis express http://localhost:<port>/ I see nothing.

the console app is issuing the simple rest calls using gets and puts issued by following HttpWebRequest client.

HttpWebRequest request = (HttpWebRequest) WebRequest.Create(JournalServiceProxy.GetAppendOperationUri());

I've tried adding the following statement to the request client to force data flowing through fiddler proxy but no change in result.

request.Proxy = new WebProxy("http://127.0.0.1:8888/");

is there a post that covers what i'm overlooking?

robertob

unread,
May 13, 2015, 9:34:27 PM5/13/15
to httpf...@googlegroups.com
looking at search results for "fiddler capture of iis express traffic" I see hit http://stackoverflow.com/questions/4706468/using-fiddler-with-iis7-express suggesting that I need to use the following to address this scenario

static function OnBeforeRequest(oSession:Fiddler.Session)
{
    if (oSession.HostnameIs("MYAPP")) { oSession.host = "localhost:portnumber"; }
}

or

have console app issue calls against http://localhost.fiddler[:port]/ which apparently fiddler will convert to a http://localhost[:port]/ call.

robertob

unread,
May 13, 2015, 9:41:35 PM5/13/15
to httpf...@googlegroups.com
tried the following FiddlerScript custom entry and changed console app to issue calls against fiddleriisexpress and still no capture, also tried using localhost.fiddler:58865 for destination and that failed as well

static function OnBeforeRequest(oSession: Session) {
    // this allows fiddler to capture iis express traffic
    if (oSession.HostnameIs("fiddleriisexpress")) { oSession.host = "localhost:58865"; }
}

EricLaw

unread,
May 14, 2015, 10:41:37 AM5/14/15
to httpf...@googlegroups.com
The .NET Framework is hardcoded to bypass the proxy for "localhost".
Typically, the IIS Express/Cassini webserver requires the Host header of the inbound request to be "localhost."

In most cases, the best approach here is to not mess with FiddlerScript at all; simply use http://localhost.fiddler:58865/ where "58865" is the appropriate port. Fiddler will replace "localhost.fiddler" with "localhost" as it processes the request.

You didn't explain specifically what you mean when you said "that failed as well". What exactly happened?

robertob

unread,
May 14, 2015, 12:18:53 PM5/14/15
to httpf...@googlegroups.com
Thanks for the response, additional details and recommendation.

I retested using http://localhost.fiddler:<iisexpressport>/ and this time the request/response traffic was captured.

I retested using OnBeforeRequest(oSession: Session) {  if (oSession.HostnameIs("fiddleriisexpress")) { oSession.host = "localhost:<iisexpressport"; } } and this time the request/response traffic was captured.

The problem when I first tried both of these was user error as my console applications App.config, which contained urls for client to use, was not getting updated in bin\Debug and so it wasn't sending requests to expected urls.

This all worked on a current clean repave win10 10074 and vs15 enterprise rc 22823 dev wks setup.

Reply all
Reply to author
Forward
0 new messages