In IIS7, when you add a new web SITE, is that the same as adding a new application too?

I'm trying to get an understanding of what's going wrong with my website development now I'm using IIS7.  Every answer I've had to questions on here this week has tended to leave me none the wiser or at worst pointed me to a website rather than answer the actual question directly, so I'm hoping this one will work out better...

So to the question: when I add a website to IIS7, is that new website automatically a new application too? (e.g. a root application?) If not, then what is it? Or how am I meant to structure a new web site?

(P.S - I still have some other open questions that I'd like answers to, do look at those if you can help!)
LVL 10
Who is Participating?
are you trying to place all your code and web.config files under a specific folder in the website ?

basically if you want your application to run, you should have your web.config file in the root of the application. so, right click to the folder and convert is to application. (a regular folder is not an application, it is just a folder under application)

And if you convert the folder to application, the root folder of that application will be the folder where your web.config file is in.

not being able to run the site under a regular folder in a website does not get the website out of the application status. you still can put a web.config file and some code files under the root of the website and it will be a regular web application.
Carl TawnSystems and Integration DeveloperCommented:
Yes, if you create a new site then IIS will automatically make it an application too, and assign it to the default application pool.

basically all of the web sites you add are applications when they are created. they run under an application pool which have a .net version.  

I think you are confused by this:
a web application, for example an application is something that contains code files and a web.config file. Web.config file is equivalent to app.config file of an application. I think you see it necessery to have these files for the website to be counted as an application.

No, in IIS 7 you do not need to have code under the website for it to be an application.

For example: if you do not have a home.aspx file but you wish to open the file http://localhost/home.aspx file, you will see an error page. this alone is a proof that a website running under IIS 7 is a website.
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

najhAuthor Commented:
Right, so when I have trouble with getting this error:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

and i don't have any virtual directories in my website and people tell me to convert my site to an application, what do they mean? If it's already an application then why would it need converting?

All I really want to do is have a website with a certain part of that site being under forms authentication control, but not all of it.  Just a bit - and that could be a page or a directory (I don't mind which).  But as soon as I try i start getting bogged down in these same errors, and the advice I always get seems to revolve around converting the website into an application.  Why would people tell me to do this if websites already are applications?
Carl TawnSystems and Integration DeveloperCommented:
Do you have a web.config in a sub directory of your site?
najhAuthor Commented:
I'm not trying to put all my code and web.config files into a specific folder - just wherever they'd naturally go.

I have a web.config file in the root, yes.  And it does indeed run just fine.
 structureSo here's a website (called MENU) and it has a folder in it called "test". I can access stuff in the root and in the test folder without any problems. There's a web.config in the root and there's also one in the test folder.  (the one in the test folder is used to specify what the default documents are - nothing more)

I've added an aspx file into the "test" folder called PrivateStuff.aspx.  I'd like to be able to use Forms authentication to control who can access that.  As soon as I try doing that, I get my error that I quoted above.  How would you add such authentication?
Carl TawnSystems and Integration DeveloperCommented:
The error suggests you are trying to enable forms authentication in the config file inside your "test" folder, which you cannot do because it is not defined as an application. You need to enable forms authentication in the config under the root folder of your site, and then use authorization rules to restrict access to the sub directory.

So your config would look something like the one in the following:
najhAuthor Commented:
ooo this sounds promising!  let me try some stuff first...
basically you can use the web.config file under the root of your application to configure properties (authorization etc.) of every folder in that application. you do not need to define web.config file for each of the folders in your application.

delete the web.config file in test folder, and add this to the web.config file under menu application. (inside configuration tag in web.config)

<location path="test">
				<deny users="?"/>

Open in new window

najhAuthor Commented:
Thanks to you both.  You both said things which really helped me clear up some of the issues I've been having!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.