Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Domain or binding name for azure compute emulator

I need to run a Web Role in azure compute emulator under domain name rather than localhost ip address (127.0.0.1). I can configure my project run regular web app on local IIS, so I can use actual domain name rather than development server ip addresses...

My application is very url specific because i use subdomains to define States (US States). For example, i need azure emulator to use something like: http://wa.myapp.net, but not http://127.0.0.1 which doesn't make sense to me.

I have a lot of features that relay on sub-domains in my url. With regular web app I can configure this to run on IIS and set the url in my project (and bindings in IIS), but I don't see any way how I can do it in azure emulator.

Right now I have a work around. I just configured my local IIS to point to the application folder, I can run my app and then just attach my visual studio to iis process. But in this case some features don't work because azure role is not running... so it doesn't quite solve the problem...

Please, need an advice.

Thanks!

like image 952
Alex Pryiomka Avatar asked Nov 04 '22 01:11

Alex Pryiomka


1 Answers

The MSDN article Configure a Web Role for Multiple Web Sites explains how to do this.

You can add extra bindings with a hostHeader attribute that specifies a custom domain in ServiceDefinition.csdef.

For example:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-03.2.0">
    [...]
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="WebSvc" />
          <Binding name="Endpoint1" endpointName="WebSvc" hostHeader="my.custom.domain.com" />
        </Bindings>
      </Site>
    </Sites>
    [...]
  </WebRole>
</ServiceDefinition>

You still will need to setup the host override on your machine in C:\Windows\System32\drivers\etc\hosts, and navigate to the correct URL.

like image 58
Bart Verkoeijen Avatar answered Nov 09 '22 08:11

Bart Verkoeijen