I have set up my hostheader in the service definintion file as follows:
<Site name="Example" physicalDirectory="..\example.WebUx">
<Bindings>
<Binding name="Example" endpointName="HttpIn" hostHeader="www.example.com" />
</Bindings>
</Site>
When I enter www.example.com it goes to the correct web site in my role. However when I enter just example.com without the www then it goes to the default web. I tried the following and it didn't help:
<Site name="Example" physicalDirectory="..\Example.WebUx">
<Bindings>
<Binding name="Example" endpointName="HttpIn" hostHeader="www.example.com" />
<Binding name="Example" endpointName="HttpIn" hostHeader="example.com" />
</Bindings>
</Site>
I tried the following and it came up with an error message "Error 1 Found duplicate site elements defined with same virtual path 'Example/' for role Default.WebUx
<Site name="Example" physicalDirectory="..\Example.WebUx">
<Bindings>
<Binding name="Example" endpointName="HttpIn" hostHeader="www.example.com" />
</Bindings>
</Site>
<Site name="Example" physicalDirectory="..\Example.WebUx">
<Bindings>
<Binding name="Example" endpointName="HttpIn" hostHeader="example.com" />
</Bindings>
</Site>
I tried just the following and it didn't work. When implemented this way both the www.example.com and example.com went to the default web.
<Site name="Example" physicalDirectory="..\Example.WebUx">
<Bindings>
<Binding name="Example" endpointName="HttpIn" hostHeader="example.com" />
</Bindings>
</Site>
I'm running out of ideas :-( Does anyone have experience of setting up the hostHeader so that it can accept both the www and non-www versions of my web sites.
Thanks
Here's some links that I also checked. Unfortunately they don't seem to help
Link 1
Link 2
I don't think you will get a domain to work with the Azure DNS.
I may be a bit out of date, but I believe the way to get Azure DNS to work is through CNAME - and CNAME works on subdomains, not on domains
looks like your binding name attribute is the same.
<Site name="Xxx" physicalDirectory="..\Xxx.WebUx">
<Bindings>
<Binding name="Xxx" endpointName="HttpIn" hostHeader="www.xxx.com" />
<Binding name="THE_NEXT_NAME" endpointName="HttpIn" hostHeader="xxx.com" />
</Bindings>
</Site>
For a top-level domain, you have to add an A record pointing to the Virtual IP of your hosted service. This is the same for all your web role instances. However, this is pretty volatile, as your VIP will change if you delete your deployment.
I have not testing top-level domains with multiple sites in a web role, so not sure if you will still run into host header issues beyond this solution. But the above will work for a web role hosting a single site.
Related
This Is my Host file
192.168.1.15:33693 stackoverflow.com
192.168.1.15 stackoverflow.com
first line i get nothing
second line i get iis page
i want to get my site buy it does not working
this is my applicationhost.config File
<site name="stackoverflow" id="14">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\stackoverflow\Desktop\stackoverflow\stackoverflow" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:33693:localhost" />
<binding protocol="http" bindingInformation="*:33693:192.168.1.15" />
</bindings>
</site>
Using the IIS manager, define a binding like so:
Equivalently, you can add the following binding statement in applicationhost.config:
<binding protocol="http" bindingInformation="*:80:stackoverflow.com" />
Additionally, 192.168.1.15 needs to be the IP of your machine. Using 127.0.0.1 is usually a better option to use in the host file in case your IP is assigned by DHCP.
I can connect to my Web API app from a browser or from another app (such as a Windows Forms app) by going to:
http://localhost:28642/api/inventoryitems/GetAll
...but how can I make localhost available to others (on the same network) so that they can make these same REST calls?
Is it just a matter of them connecting to my machine, like so:
http://platypus:28642/api/inventoryitems/GetAll
...and if so, what do I have to do to make it accessible (if anything)?
At any rate, I don't really want to have to run my Web API app all the time on my machine, so: How can I set it up so that it will run 24/7 without my having to start/babysit it?
Would an Azure web site be a valid option for this?
UPDATE
It could be (based on what I read here) that changing applicationhost.config from this:
<site name="HandheldServer" id="20">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\HandheldServer\HandheldServer" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:28642:localhost" />
<binding protocol="http" bindingInformation="*:28642:platypus" />
<binding protocol="https" bindingInformation="*:44300:localhost" />
</bindings>
</site>
...to this:
<site name="HandheldServer" id="20">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\HandheldServer\HandheldServer" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:28642:localhost" />
<binding protocol="http" bindingInformation="*:28642:platypus" />
<binding protocol="http" bindingInformation="*:28642:" />
<binding protocol="http" bindingInformation=":28642:" />
<binding protocol="https" bindingInformation="*:44300:localhost" />
</bindings>
</site>
...will make it available (but, will I have to be running it, or will IISExpress fire it up in the background?)
Presumably, the first entry may already make it available. I don't know if the prepended * is necessary, so I have an entry both with and without that.
You have the choice :
buy a Rasperberry Pi in order to have an independant server/service running instead of your machine
buy a VPS
open the firewall ports on your router
use your smartphone (yes it's possible)
change your hosts file (windows, linux, mac)
there is no miracle ;)
I am testing OAuth with local application hosted on dev fabric.
I want to bind a particular hostname to my local application, usually on IISExpress I would edit the following element in ApplicaiontHosts.config
<site name="BasicChat" id="15">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\xxx.yyy_VAIO\Downloads\Samples-master\Samples-master\BasicChat" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:44914:localhost" />
</bindings>
</site>
What would be the equivalent when I'm testing on DevFabric? How can I alias the call to localhost?
In the ServiceDefinition.csdef.
Add the hostheader attribute eg:
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="xxx" hostHeader="my.yyy.com" />
</Bindings>
Is it possible in Azure to have multiple hostHeader on a single Binding or is it mandatory to create one Binding for each hostheader ?
Example :
<Sites>
...
<Site name="sample.com" physicalDirectory="..\sample.com">
<Bindings>
<Binding name="ep_sample" endpointName="Endpoint1" hostHeader="www.sample1.com,www.sample2.com,www.sample3.com" />
</Bindings>
</Sites>
Or do I have to create each binding entry for single hostHeader (knowing that the site path is the same)?
I believe it has to be done like this:
<Sites>
...
<Site name="sample.com" physicalDirectory="..\sample.com">
<Bindings>
<Binding name="ep_sample1" endpointName="Endpoint1" hostHeader="www.sample1.com" />
<Binding name="ep_sample2" endpointName="Endpoint1" hostHeader="www.sample2.com" />
</Bindings>
</Sites>
I have two web applications built with asp.net MVC3. I want to run them locally with custom domain and without any port number in the urls. no need to worry about remote access etc. this is just for local development enivronment only
eg:
htp://app1.cc.com-->Application1
htp://app2.cc.com-->Application2
I need something like htp://app1.cc.com/questions/4709014/using-custom-domains-with-iis-express
currently my URLs are like http://localhost:34752/questions/4709014/using-custom-domains-with-iis-express
I followed the steps in this question:
Using Custom Domains With IIS Express
but this is using the reserved port 80, which is fine but how do I share this port with two applications?
Just add bindings in your applicationhost.config
Something like this
<site name="site1" id="1" serverAutoStart="true">
<bindings>
<binding protocol="http" bindingInformation="*:80:app1.cc.com" />
</bindings>
</site>
<site name="site2" id="2" serverAutoStart="true">
<bindings>
<binding protocol="http" bindingInformation="*:80:app2.cc.com" />
</bindings>
</site>