DevFabric equivalent of ApplicaiontHosts.config? - iis

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>

Related

Setting IIS Application VirtualDirectory physicalpath

I have a .bat file with the following line that runs appcmd to install the sites contained in sites.xml
%windir%\system32\inetsrv\appcmd add site /in < .\sites.xml
sites.xml contains the following
<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
<SITE SITE.NAME="Default Web Site" SITE.ID="1" bindings="http/*:80:,net.tcp/808:*,net.pipe/*,net.msmq/localhost,msmq.formatname/localhost,https/*:443:" state="Started">
<site name="Default Web Site" id="1" serverAutoStart="true">
<bindings>
<binding protocol="http" bindingInformation="*:80:" />
<binding protocol="net.tcp" bindingInformation="808:*" />
<binding protocol="net.pipe" bindingInformation="*" />
<binding protocol="net.msmq" bindingInformation="localhost" />
<binding protocol="msmq.formatname" bindingInformation="localhost" />
<binding protocol="https" bindingInformation="*:443:" />
</bindings>
<limits />
<logFile />
<traceFailedRequestsLogging />
<applicationDefaults />
<virtualDirectoryDefaults />
<application path="/">
<virtualDirectoryDefaults />
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot" />
</application>
<application path="/MyWebsite" applicationPool="MyWebsite">
<virtualDirectoryDefaults />
<virtualDirectory path="/" physicalPath="D:\Projects\MySolution\DEV\Source\MyWebsite" />
</application>
</site>
</SITE>
</appcmd>
I need to make part of the virtualdirectory physicalpath D:\Projects\MySolution be whatever the currentdirectory is.
Is there any variable that I can insert in sites.xml to make that happen?

How I define Fake Host in iis?

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.

How can I set up my Web API app to be available over the network?

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 ;)

Webrole - Multiple hostHeader on a single Binding?

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>

IIS 7.5 Express New Virtual Dir

how do i add new virtual directory?
I'm getting error (The type or namespace name 'xxx' could not be found) but the files are all in /bin.
i have tried editing the applicationhost.config like this:
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/" applicationPool="Clr2IntegratedAppPool">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
<virtualDirectory path="/SubFolderApp" physicalPath="%IIS_SITES_HOME%\WebSite1\SubFolderApp" allowSubDirConfig="true" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:localhost" />
</bindings>
</site>
You need to create a child application. Your configuration created child virtual directory. The configuration below turns /SubFolderApp into an application.
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/" applicationPool="Clr2IntegratedAppPool">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<application path="="/SubFolderApp" applicationPool="Clr2IntegratedAppPool">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1\SubFolderApp" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:localhost" />
</bindings>
</site>

Resources