Rectangle 27 0

asp.net How do i get IIS to make a website available at a specified URL?


According to this stackoverflow.com/a/6297660/954927 I should be able to add multiple sites under inetpub/wwwroot and access them as localhost/website1 localhost/website2 etc. But when I set up IIS in this way with a simple static file at wwwroot/website1 and wwwroot/website2 and navigate to localhost/website1 I get an error which indicates the request is being routed to inetpub\wwwroot\index.html which cannot be found.

Application Pools can be thought of as crash protection boundaries. Applications in one pool are protected from crashes in other pools. By default, an application pool is created for each new site, and is named the same as the site (so each site is protected from other sites). You can override the default application pool mapping during site creation or afterwards.

IIS can often be confusing and frustrating, even if you know how the underlying protocols and systems work. First, you can't have a web site on the internet at a particular path. The host name (and/or IP address and port) determines the server that controls the site. Paths are simply a convenient organizational tool within a site. Given this restriction, IIS naturally requires that you create something that listens at the hostname (again, and/or IP address and port) level. IIS calls this a "site". Once you've created your site, you can create an application or virtual directory within that site. The only difference between an application and a virtual directory is that an application can run its own code in its own application pool. Either one is always handles a subpath of its parent (which is either the site or another virtual directory or application). This is because of how IIS processes the request. After finding the appropriate application for the request by using the IP address, port, and hostname, it sends the request to the application. The application then looks at the first part of the path given in the request and uses that to find the appropriate application or virtual directory, which then does the same thing with the next part of the path until it cannot match the next subpath part to a configured application or virtual directory. If the last item found is a virtual directory, it just serves up the static files at the configured physical path. If it's an application, it passes control to the code for the application if there is any. If there is no code for the application, it treats the application as if it were just a virtual directory.

On a given server, you can set up as many sites as you like. In a given site, you can set up as many applications as you like, and on a given application, you can set up as many virtual directories as you like.

Reading through what you have written it seems that if I have an IIS application at 'WebSite1/Application1' that I need something to exist at 'WebSite1' that fowards all './Application1' urls to Application1. Is there nothing straightforward that can do this? If not how is IIS supposed to serve more than one website, or is it only intended to serve one website?

The site can be completely empty (in this case, it just acts as a holder for applications). The same also holds true for applications (in which case they're basically just a virtual directory).

When troubleshooting or first setting up a system, it's usually a good idea to first get the site working (and make sure you're hitting the site you think you're hitting), then add the applications one at a time and get each of those working (without messing with the site). If you have code at any of the levels, first test it without the code and then test it with the code. If the static files succeed but the code doesn't, it may be an application pool settings issue. Test it from the local machine first, then from another machine (if needed). If it works locally, but not from another machine, it's probably a firewall or network issue.

When you're setting up your own website, you can either use the preconfigured 'Default Web Site', which listens to port 80 on all IP addresses, or a site you create yourself. However, keep in mind that IIS can easily get confused if you try to create two items that listen to the same URL, so if you create your own site that attempts to listen to the same URL as the default web site, it won't work. You may need to disable (or delete) the default web site first, by right-clicking on the site and choosing Manage Web Site/Stop.

Where are the files you're trying to serve up and how did you configure IIS to point to that directory?

Note
Rectangle 27 0

asp.net How do i get IIS to make a website available at a specified URL?


  • Add: the local IUSR , ANONYMOUS LOGON and NETWORK SERVICE they need at least "Read" and "List folder contents" rigths
  • After the virtual directory appears under the Default web site three , rigth click on it > edit permissions > Security > edit
  • In Features View, double-click Authentication > On the Authentication page, select Anonymous Authentication.
  • In the Actions pane, click Edit to set the security principal under which anonymous users will connect to the site.
  • In the Edit Anonymous Authentication Credentials dialog box, select one of the following options: -- Specific user, ( IUSR ) -- Application pool identity, if you want IIS processes to run by using the account that is currently specified on the property page for the application pool. By default, this is the Network Service account. Important If you use the Network Service account, you grant anonymous users all the internal network access associated with that account.
  • Server name > sites ,then right click the "Default Web Site" > "Add virtual directory" and fill in the name and the path to the directory to be shared
  • Switch to feature view , in the central pane double click "directory browsing" and click "enable" under the action pane on the right ( Be sure your newly created virtual directory is highligthed )

After using this process to add virtual directries to my IIS website tree I was able to convert the virtual directories to applications with no problem.

I discovered a solution to the authentication issue of the default IIS configuration not being able to access the content directories you create here https://forums.iis.net/search?q=authors%3A%28Beaker007%29&s=postDate&d=desc

Note