Setting the default application in IIS 7? - iis-7

How do you the default application in IIS 7?
I have the default web site node with several applications underneath it.
Each application has its default document loaded and if I point my browser to
http://server/appName
It works fine, it resolves to that apps default document set in the IIS settings.
How can I set it so that if I go to
http://server
It will automatically go to http://server/appName
A caveat is that the default web site's root is c:\inetpub\wwwroot where as my applications are located in c:\websites\app1,app2,etc...

You could just put an index.html file in there with a meta redirect in it.

I asked the same question on Server Fault, and figured out that you can change the physical path of the default web site (see my answer).

Related

How to create Application in the IIS Default Web Site root (virtual path : '/')?

Context
I have an Asp.Net MVC application. I would like to deploy it to an IIS (Windows Server 2016). I do not care which will be physical path, but I would like to access to the application in the virtual path '/'
(I am using Package web publish method, because no online access to the server, but I think this question is on IIS/ASP and not about publishing. I clearly miss some basic concept about IIS/ASP.)
What I've tried
1) When I try to create an Application in IIS then the dialog forces me to add an application Alias, which becomes the part of the virtual path. So regardless the physical path now the the url will be
myserver/myapp/mypage instead of myserver/mypage
which is not what I want. I would like to access to the page as myserver/mypage
2) If I simply deploy the app under wwwroot then it will appear as myserver/mypage it seems to be working, but where is the "Application" this case? (see picture).
Question
Maybe I missing something: Is this the Default Web Site is an "Application" in its own right? How to configure then its Application settings? If not, then how can I create an Application which's virtual path is '/'?
If I have understood your question correctly, you want to access the application as servername/pagename. In order to do so, do not create an "application" or "virtual directory" under a "website". Instead, directly host the content under Default website. You can change its path under "Basic Settings" and point it to your content folder.
You can also create another website at port 80 and point it to the location where your content is present. However, you will not be allowed to create 2 website with the same IP-port-hostname combination. You can solve this problem further in 3 ways.
If Default web site is not in use, then instead of creating another website, click on Default website, select basic setting from right hand panel and change the path to application content folder.
If Default website is in use, then create another another website at port 80 with a hostname.
If you do not have a hostname and are accessing the application using server-name, then you will have to modify the port to 8080 or something like that.
Refer my blog - https://blogs.msdn.microsoft.com/parvez/2016/07/27/iis-bindings/ for more information about IIS bindings

Change IIS Application address

I need to know if Its possible to change my web site address.
I have IIS application locate under Default Web Site\MyApp And the address is:
http:/localhost/myapp
And I want to change the address to
http://localhost
Without the /myapp Its possible to do that without to move the application directory?
In IIS you can change the Physical path of your Default Website.
Right-Click "Default Web Site" --> Manage Website --> Advanced Settings
You need to modify your web.config file or another way is, you can configure default document in IIS. Here is the link that might help :
https://www.iis.net/configreference/system.webserver/defaultdocument

Can't Tell Where IIS Inheritance is coming from

This is on a Windows 2012 Server. I have a vendor application that "installed" a site to my IIS. It placed it under the default website as an application. However I want to move it to a different website with a different binding.
The only problem I can see so far is that it has a default document setting that is being inherited however I cannot tell from where it's being inherited. The setting isn't in the web.config. When I create a new site under my preferred binding I get the regular inheritances such as index.htm, index.aspx, etc. When I add the default document manually the original site will get an error about duplicate web.config entries and crash the app pool.
Now so far I've looked and the default document setting is not in the app's web.config, it's not in the parent site's web.config, it's not on any of the other sites on the IIS server up the hierarchy. It's not on the machine.config or server web.config in the windows\microsoft.net\framework64/v4.0.30319\Config folder either.
I can get around this problem without too much difficulty, but I'm just really curious to learn how this setting is being inherited and from where. Can anyone point me to any other places to check?
Check the application host configuration file. On IIS 7+ it is located in %windir%\System32\inetsrv\config\applicationHost.config

Why is a Web Site project not serving pages except through IIS?

I have inherited quite a complex web site project, and when I run it in VS 2012 under the default "Use default Web server" setting for "Server", it serves the login page correctly, under the base URL http://localhost:45632 and I can log in nicely. Then, when I click a menu item with the URL http://localhost:45632/Apps/Visitors/General.aspx, I get a good and plain 404.
If I then create a web site (not application under the default site) for it in IIS 7.5; set the physical directory to the project's source folder; give it a host name, xtjethro.local, and edit my hosts file to point that host name to 127.0.0.1; set the web site project to use a custom server, with a base URL of and finally, browse the site from its context menu, it serves its pages under the base url http://xtjethro.local/ instead of http://localhost:45632, everything works fine.
Then, if I set the web site project to use a custom server with a base URL of http://xtjethro.local, and restart VS2012, running it as administrator, everything works from there as well.
I would like to know why http://localhost:45632/Apps/Visitors/General.aspx doesn't work under VS2012, but http://xtjethro.local/Apps/Visitors/General.aspx does work under IIS.
The Visual Studio development web-server usually runs the site under a virtual directory which matches your project name. That would mean that the URL of your page should be http://localhost:45632/YourProjectName/Apps/Visitors/General.aspx. If you create an application under the default site in IIS, you will probably see the same problem.
You'll need to change the way your links are generated. Instead of using /Apps/..., use ~/Apps/... - ASP.NET will automatically resolve ~/ to the base path of the site.

Set default directory in Asp.net

Is there a way to configure the default directory in web.config?
My Default.aspx file is not in the root folder but in /Public/Default.aspx.
I found this post : Set Default Page in Asp.net but it does't work, probably because it's only to configure the default page and not the default directory...
You'll want to configure this in IIS.
You have your website already setup, and all you need to do is add an "Application" within that website.
Add Application...
You can also create a Virtual Directory which would give a similar result. Unfortunately you will still be navigating to http://example.com/public/
My question to you is, what is in the wwwroot directory? Is there a different website? Why not launch two websites within IIS?
Here's more information C/O #waqas

Resources