0

I just want to know, it is really necessary to include web config file while we hosting the ASP.Net web application in IIS.

If Yes, Why and where it should be along with reason.

If No, Why and what is the reason.

Appreciate your assistance!

Kind Regards,

Padmanaban
  • 119
  • 1
  • 3
  • 15

2 Answers2

4

Web.Config Contains all the server configuration information (settings) related to each web application.

Read more here or the wiki page here

There should be at least 1 web.config in the root folder of your web application.

But if you want different settings for sub folders of your application you can place more web.config files in your sub folders, otherwise the sub folders will take root web.config by default.

CoOl
  • 2,637
  • 21
  • 24
  • Right but i need to know the importance of web config file. that it should be included in IIS in where we mapped but where it should be and impacts if its not in a right place – Padmanaban Aug 20 '15 at 08:14
1

The web.config on your site is come hierarchically to overwrite the default web.config that all ready used by asp.net and found on the config path inside the asp.net directory inside the windows folder.

In that default web.config on the high level many modules loaded by asp.net that needs to read a lot of parameters.

So many modules that by default loaded needs the web.config to properly work.

Also asp.net is check if the web.config exist and if you have write permission to it so he can handle it.

And to direct answer your question, in a complicate system there is not direct point to show you and tell "this modules need to read that parameter"... so the web.config is needed to run properly...

Its worth reading this article about optimizing web.config where the remove and the <clear /> is used to keep only the necessary modules for your site.

Here is a snipet from that article to show you that you need at least use it and remove the modules that you do not use

<httpModules>
         <!--<span class="code-comment"> Remove unnecessary Http Modules for faster pipeline --></span>
         <remove name="Session" />
         <remove name="WindowsAuthentication" />
         <remove name="PassportAuthentication" />
         <remove name="AnonymousIdentification" />
         <remove name="UrlAuthorization" />
         <remove name="FileAuthorization" />
</httpModules>

Also IIS use web.config when you setup your site - IIS store many information's about the site on web.config.

Aristos
  • 66,005
  • 16
  • 114
  • 150
  • I have one more question to you... We were facing random issues like suddenly the site gets down and its automatically resolved after a some minutes say 15mins. Its was throwing an error as [Error link](http://stackoverflow.com/questions/10783651/error-the-details-of-the-application-error-from-being-viewed-remotely?answertab=votes#tab-top) @Aristos as i searched and found that web config file should be on a specific folder but i didnt get the concrete idea about the issue why its happening and how is resolving automatically... – Padmanaban Aug 20 '15 at 08:29
  • 1
    @Padmanaban we place web.config on other directory only for permissions purpose... You site may gets down for many different reasons. Eg do you upload large files ? Do you have any attract that you miss ? Maybe some code is stack ? – Aristos Aug 20 '15 at 09:18