Force visual studio to start development server using the hostname localhost. (with period at end)
Asked Answered
M

4

4

Is it possible to change the hostname that the development server fires up in visual studio 2008? Ultimately I would like visual studio to start directly on http://localhost.:xxxx/ (note the period). As I am doing more ajax type calls I find that I need to inspect traffic more often using tools like fiddler to check responses/requests. (Fiddler cannot see requests over http://localhost/ as they do not traverse the regular network stack).

I looked through the web server configuration page but nothing jumped out.

I don't particularly want to go the route of configuring IIS on the box but would consider it with a compelling answer.

Michealmicheil answered 16/10, 2009 at 12:30 Comment(2)
FWIW, IE9 will automatically pick up localhost traffic when Fiddler's running; no more manual steps are needed.Simonides
Thanks for the update - and the awesome tool.Michealmicheil
S
7

If you have a simple setup, you might try a new option added in v2.2.4.0.

Inside the registry, under HKCU\Software\Microsoft\Fiddler, add a new Reg_SZ named HookWithPac with the value set to True. You should find that Fiddler now registers as the system proxy using a simple PAC script rather than manually specifying 127.0.0.1:8888. This, in turn, causes IE to send LocalHost traffic to Fiddler.

Please let me know if this works out for you!

Simonides answered 27/10, 2009 at 2:47 Comment(1)
Eric - seems to work perfectly. Fiddler is such a great tool - thanks.Michealmicheil
P
2

I tried Eric's suggestion and this half-worked - Fiddler was tracking traffic from my Visual Studio development server to other servers but still wasn't registering traffic from IE to localhost (without the dot before :xxxx port number). (Windows 7, Visual Studio 2008, Fiddler 2.3.1.0, IE8).

I had to go into Fiddler options -> Connections & check 'Use PAC Script'. Now I see all traffic.

I would also like to say thanks for such a great piece of software; Fiddler is the single most useful free tool I have ever used!

Pankey answered 25/11, 2010 at 1:54 Comment(0)
A
1

You could add code to Global.asax to redirect to localhost. if you're not coming from it already. However, make sure that such code doesn't end up in production.

Anagnorisis answered 16/10, 2009 at 12:55 Comment(3)
Thanks, that is an idea. Hopefully I don't have to resort to it but it's worth bearing in mind.Michealmicheil
Interestingly enough the request.Url does not retain the period in the url. In evaluating this approach I had to rely on the presence of localhost. in the host header that is passed with the request.Michealmicheil
This is just a helpful update for others thinking about this approach. After trying this method out for a a couple of days I notice that debugging shuts down after a little while using the redirect - not sure why - I guess VS picks up the redirect and assumes you are off the site.Michealmicheil
S
0

You could also just hit http://localhost.:2147 which will cause fiddler to trap traffic to localhost.

Seducer answered 17/12, 2009 at 18:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.