Solved

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

Posted on 2011-03-03
10
600 Views
Last Modified: 2012-05-11
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!)
0
Comment
Question by:najh
  • 4
  • 3
  • 3
10 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35026575
Yes, if you create a new site then IIS will automatically make it an application too, and assign it to the default application pool.
0
 
LVL 9

Expert Comment

by:jkofte
ID: 35026649
hello,

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 asp.net 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.
0
 
LVL 10

Author Comment

by:najh
ID: 35026723
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?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35026773
Do you have a web.config in a sub directory of your site?
0
 
LVL 9

Accepted Solution

by:
jkofte earned 250 total points
ID: 35026809
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.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 10

Author Comment

by:najh
ID: 35027145
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?
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 250 total points
ID: 35027201
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:

    http://my.re-invent.com/helpdesk/KB/a190/how-can-i-configure-forms-authentication-on-sub-directory.aspx
0
 
LVL 10

Author Comment

by:najh
ID: 35027744
ooo this sounds promising!  let me try some stuff first...
0
 
LVL 9

Expert Comment

by:jkofte
ID: 35028144
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">
		<system.web>
			<authorization>
				<deny users="?"/>
			</authorization>
		</system.web>
	</location>

Open in new window

0
 
LVL 10

Author Closing Comment

by:najh
ID: 35028380
Thanks to you both.  You both said things which really helped me clear up some of the issues I've been having!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now