Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8644123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:13:05+00:00 2026-06-12T12:13:05+00:00

I have an Azure deployment with two sites configured on a single web role,

  • 0

I have an Azure deployment with two sites configured on a single web role, like so:

<WebRole name="Studio" vmsize="Small">
    <Sites>
      <Site name="Studio" physicalDirectory="..\Studio">
        <Bindings>
          <Binding name="HttpIn" endpointName="HttpIn" hostHeader="studio.mydomain.localhost" />
        </Bindings>
      </Site>
      <Site name="Admin" physicalDirectory="..\Admin">
        <Bindings>
          <Binding name="HttpIn" endpointName="HttpIn" hostHeader="admin.mydomain.localhost" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="HttpIn" protocol="http" port="80" />
    </Endpoints>
    <Imports>
      <Import moduleName="Diagnostics" />
    </Imports>
</WebRole>

I also have the addresses mapped in my hosts file:

127.0.0.1   studio.mydomain.localhost
127.0.0.1   admin.mydomain.localhost

This works fine, and if I test in the browser, using http://studio.mydomain.localhost:81/ and http://admin.mydomain.localhost:81/, then I get two different index pages, as expected.

But, if I hit F5 in Visual Studio, it insists on trying to launch http://127.0.0.1:81/, which of course results in a 404 Bad Request error.

Is there any way I can get VS to launch the correct address immediately from F5? It’s only a small thing but it’s time consuming to have to retype the address each time.

And, while we’re on the subject, how does Azure choose which of my roles to launch when I hit F5? I have a web service role in the same Azure project. Why doesn’t it try to launch that? Are them some settings I’m missing or is this all controlled by the order things appear in ServiceDefinition.csdef?

I’ve had a look at the following articles (among others). While both are informative, I can’t see the answer to this in either:

http://blog.elastacloud.com/2011/01/11/azure-running-multiple-web-sites-in-a-single-webrole/

http://msdn.microsoft.com/en-us/library/windowsazure/gg433110.aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:13:07+00:00Added an answer on June 12, 2026 at 12:13 pm

    Actually there is a workaround to start all sites (you’ll need to click a button though). First, you need to know how to:

    • Get the host header for each site (ServiceDefinition)
    • Get the current port (RoleEnvironment)
    • Get the current IP for sites without hostheader (RoleEnvironment)

    Here is a small app that gets the info, aggregates it, and launches internet explorer (you can improve the code to skip TCP endpoints etc…):

        static void Main(string[] args)
        {
            var document = System.Xml.Linq.XDocument.Load(Path.Combine(args[0], "ServiceDefinition.csdef"));
            var siteBindings = from binding in document.Descendants()
                               where binding.Name.LocalName == "Binding"
                               select new
                               {
                                    Role = binding.Parent.Parent.Parent.Parent.Attribute("name").Value,
                                    EndpointName = binding.Attribute("endpointName").Value,
                                    HostHeader = binding.Attribute("hostHeader") != null ? binding.Attribute("hostHeader").Value : null
                               };
    
            var endpoints = RoleEnvironment.Roles.SelectMany(o => o.Value.Instances)
                                                 .SelectMany(o => o.InstanceEndpoints);
    
            foreach (var siteBinding in siteBindings)
            {
                var endpoint = endpoints.FirstOrDefault(o => o.Value.RoleInstance.Role.Name == siteBinding.Role);
                Process.Start("iexplore.exe", String.Format("{0}://{1}:{2}", endpoint.Value.Protocol, siteBinding.HostHeader ?? endpoint.Value.IPEndpoint.Address.ToString(), endpoint.Value.IPEndpoint.Port));
            }
        }
    

    Now, for the Visual Studio integration, go to Tools, External Tools and add a new application with as arguments $(ProjectDir).

    enter image description here

    Finally, after starting the debugger, choose the Windows Azure project in your solution explorer, go to Tools and click the Open IExplorer for Azure button. You can even add it to your toolbar.

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an azure solution configured with one MVC4 web role, and two back-end
We have a deployment on Azure with a Web Role that uses https. Since
I already have my azure web role running in cloud using azure sdk 1.6.
We have an Azure web role deployed that uses HTTPS. We upload a certificate
I have a site running on an Azure web role and I can force
I have an MVC3 project I have migrated to an Azure Web Role and
I have created my first app for azure. It's has an MVC3 web role
I have two virtual machines in my Azure deployment. The first is my frontend
I have an Azure worker role whose job is to periodically run some code
I have an Azure based web service. The service contains a web based front

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.