CrossBrowserTesting Support

Support

  • Product
    • Live Testing
    • Automated Testing
    • Record & Replay
    • Visual Testing
  • API Docs
  • Blog
  • Live Q&A
  • Start Testing
CrossBrowserTesting Support » Local Connection » Tutorials » Working with Visual Studio or IIS Express Apps Locally

Working with Visual Studio or IIS Express Apps Locally

I am writing a Visual Studio application and the application works on my machine but will not work on the local connection.

See here for a Stack Overflow explanation of the problem http://stackoverflow.com/questions/14725455/connecting-to-visual-studio-…

There are a couple of ways to get around this. By default IIS Express will only serve content to URL that looks like this http://localhost:

1. Use smart proxy
If you decide to use this option, when you run the local connection you will need to pick the Proxy Server option in the local connection. You will put your IP address and the port of the smart proxy you will use. For Charles and Fiddler the port is usually 8888, you can check this in the proxy setting for either product.
charles image 1

Charles proxy
Use the Enable Rewrite functionality to rewrite any Host header that comes in to your ip address and change it to the localhost format that iisexpress recognizes.

  • Find the Rewrite Menu option in the tools menu
    charles image 1
  • Click Enable Rewrite and Debug in Error Log and create a new set, Add a location and leave it blank to get the ‘*’ everything location, then finally add a Rule
    charles image 2
  • In the rule make sure to include your IP address and port that the Visual Studio application is using.
    charles image 3
  • For HTTPS to work you have to make sure that Charles is set to Enable SSL Proxying, otherwise it won’t be able to modify the SSL traffic. You can find that option under Proxy > SSL Proxying Settings. Make sure that “Enable SSL Proxying” is checked and your IP address is added as a location.

Fiddler proxy
Use the Custom Rules to change the Host header from your ip address to the localhost format iisexpress recognizes.

  • In the rules menu choose the Customize Rules menu option
    fiddler image 1
  • find the method named OnBeforeRequest in the notepad that pops up
    fiddler image 2
  • at the bottom of the OnBeforeRequest method add the following code. Change the code to include your IP address and port that iisexpress is using for your application
    	if (oSession.HostnameIs("CHANGE TO YOUR IP ADDRESS")) {
    		oSession.host ="localhost:YOUR_PORT_HERE";
    	}
    

    fiddler image 3

2. Change the iisexpress setup on your machine to allow for connections other than localhost

You can either look at what the stack overflow article http://stackoverflow.com/questions/14725455/connecting-to-visual-studio-…
or our directions below.

  • You will need to run Visual Studio as admin, if you do not do this these changes will not work.
  • Backup this file: %userprofile%\documents\iisexress\applicationhost.xml
  • Edit this file: %userprofile%\documents\iisexress\applicationhost.xml
  • Find the site tag that matches your application
  • Find the bindings tag for your application
  • Change the binding (the PORT should match the port your application is using)
    <binding protocol=”http” bindingInformation=”*:58934:localhost” />To this
    <binding protocol=”http” bindingInformation=”*:58949:*” />

Related

All Topics

  • Billing and Plans
  • Frequently Asked Questions
  • Integrations
  • Live Testing
  • Local Connection
  • Screenshots
  • Selenium Testing
  • Teams and Admins
  • Team Guides



Think you need a human?

Our customer success team will be glad to help you with your question.

Contact Support

Still need a free trial?

Try CrossBrowserTesting free for 7 days and see how we make testing easier.

Start Today

Want the latest tips?

Enter your email and we’ll send you tutorials and browser testing strategies right to your inbox.


Product

  • Live Testing
  • Automated Testing
  • Visual Testing
  • Local Testing
  • Integrations

Resources

  • Browsers & Devices
  • Blog
  • Webinars
  • Security
  • ROI Calculator

Support

  • Help Center
  • CBT Community
  • API Docs
  • Automation Docs
  • Schedule A Demo
  • Enterprise Request

Company

    • About Us
    • Contact Us
    • Careers
    • Terms of Use
    • 1-888-927-6973

© 2019 CrossBrowserTesting.com, LLC. All rights reserved.