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.
Related
I have an installation of IIS Express 10 on my local machine that I use for developing MVC applications. Normally, I use the following configuration in applicationhost.config for my sites, where I have no virtual directories defined:
<site name="Development Web Site" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="C:\dev\MyMVC" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
Using the above configuration, the MVC application can be accessed with no errors at http://localhost:8080
However, I recently tried to make the application accessible using a virtual directory (please note the path "C:\fake" as the root directory--IIS requires a site's root directory to be defined before any virtual directories are--see How to configure a different virtual directory for web site project with Visual Studio 2015). I created the virtual directory using the following configuration in applicationhost.config:
<site name="Development Web Site" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="C:\fake" />
</application>
<application path="/test/app">
<virtualDirectory path="/" physicalPath="C:\dev\MyMVC" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
Using the above configuration and navigating to http://localhost:8080/test/app, the MVC application begins to load, but I get the following error:
c:\dev\MyMVC\views\index.cshtml(14): error CS0103: The name 'ViewBag' does not exist in the current context
What is the virtual directory configuration doing to cause this error? It works fine without the virtual directory.
You can replicate this error using a fresh MVC template in Visual Studio, without touching any code other than what's in the applicationhost.config file, so I don't think the problem is in my code.
It turned out, that not only does IIS Express require a root directory for the site as a whole to be defined, but also every virtual directory URL segment as well. So, it worked after changing the configuration to this (note the intermediate "/test" virtual directory):
<site name="Development Web Site" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="C:\fake" />
</application>
<application path="/test">
<virtualDirectory path="/" physicalPath="C:\fake" />
</application>
<application path="/test/app">
<virtualDirectory path="/" physicalPath="C:\dev\MyMVC" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
http://localhost:8080/test/app now works properly without the 'ViewBag' error
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>
I have a website working fine on IIS express until I wanted to add a second one and have them both run off the same port number. Now I can't figure out how to get the path right. When I browse to the site after running iIS express it complains of a error:
Unrecognized configuration path 'MACHINE/WEBROOT/APPHOST/RISWEB'
and IIS Express returns error 500.19
Here is my config. When I set the path to be "/" it works, but when its something else it does not. I would like to browse to http:// c65273/risweb and have my website show up.
<site name="RISWEB" id="1834812154">
<application path="/risweb" applicationPool="ConnectPool">
<virtualDirectory path="/risweb" physicalPath="C:\c2010\risweb\RISWEB" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:c65273" />
</bindings>
</site>
I hit a similar problem and was able to resolve it by doing the following:
Remove the configuration section for the site from my applicationhost.config
In Visual Studio go to the Project Properties > Web tab and then click Create Virtual Directory to have VS recreate the configuration section.
It then worked fine, the resulting configuration section will look something like this:
<site name="WebDemos-Site" id="5">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\rvesse\Documents\My Web Sites\WebDemos-Site" />
</application>
<application path="/demos">
<virtualDirectory path="/" physicalPath="C:\Users\rvesse\Documents\mercurial\dotnetrdf\Samples\WebDemos" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:64132:localhost" />
</bindings>
</site>
Note that VS generates an empty website for the root directory of the site
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.