0

I installed IIS 7.5 (Windows 7) on two different PCs, one PC saves configuration to applicationHost.config and the other to web.config! Screenshot:

Configuration location differences

As you can see, the PC on the left does not contain the settings (they are stored in applicationHost.config) and the PC to the right does in fact store the settings in web.config.

I have not and hope not to modify the configuration files by hand and would like to do it using IIS Manager only.

Does anyone know why this happens or if there is some setting to force configuration to the web.config file? Thank you.

Edit: I am adding a screenshot of the applicationHost.config file (PC on the left) demonstrating how the configuration is stored in it instead of inside the web.config file.

enter image description here

Edit: Here are the steps that I am taking and I do make sure to work at the site level as suggested by Chris (having the site selected):

  1. Create folder named junk.tst using Windows Explorer.
  2. Copy all files and subfolders except for web.config from crop.tst (a working website) into junk.tst. Except for web.config, directory structures are identical.
  3. Launch IIS Manager, click on ‘Sites’ then ‘Add web site’. Provide basic settings for website ‘junk.tst’. Use existing ‘classic’ application pool.
  4. Clicking on site ‘junk.tst’, create bindings for ‘www.junk.tst’ and ‘junk.tst’.
  5. Double click on ‘junk.tst’ so that the IIS icons are visible. Please note that the site ‘junk.tst’ is selected on the left hand column tree view.
  6. Double click on the ‘Default Document’ icon and provide it (get rid of the other default docs).
  7. Go back to the IIS icons. ‘junk.tst’ is still selected on left.
  8. Double click on ‘Handler Mappings’ and ‘Add script map’ for my *.srf and another script map for my dll.
  9. Site ‘www.junk.tst’ is now working and handles requests made to *.srf and *.dll

Now I inspect web.config and like above, the circled config is not stored within web.config

3
  • Are you running both sites under IIS and or perhaps one under IIS Express (i.e. launched from Visual Studio)? Jun 12, 2014 at 21:51
  • I'm using IIS, not Express. I've even removed and reinstalled IIS on the machine that writes the circled (in red on screenshot) config to the applicationHost.config, just to see if I can get things consistent but there is no change. Both PCs are running Windows 7 64bit. To me, it makes much more sense to write that config to the web.config since it is configuration that pertains to the website. Jun 13, 2014 at 2:43
  • I also wanted to point out that if I add websites to the Left PC, the configuration is written to applicationHost.config and if I add a site to the Right PC, configuration is written to web.config. My guess is that IIS Manager has some setting that causes this to happen. Jun 13, 2014 at 3:05

1 Answer 1

0

When you add the handlers, where are you doing it? Modifying at the site level will put them in web.config. Modifying them at the IIS level will put them in to applicationhost.config. My guess is that you edited them at the site level one one machine and IIS level on the other.

If these handlers are part of the site config then you should just copy the web.config along with the rest of the site - no need to add the configuration manually after deploying the site, IIS will pick the settings up from the web.config.

5
  • Thanks for responding. I had tried this previously because it would make sense but as you can see the last edit on my original post, I documented the steps this time and get the same result. Jun 13, 2014 at 13:59
  • Now as far as copying the web.config that too makes alot of sense and if I remember correctly, I get some kind of configuration error about the configuration section begin locked at the parent level but I don't remember ever locking anything. Jun 13, 2014 at 14:03
  • Web.config is there to solve the exact problem of manually configuring stuff when you deploy a site - the config lives with the site itself. If you're having problems when you're deploying with the web.config then that's the problem you should be solving, as it's very likely going to point you to the root cause of the other problems too. Jun 13, 2014 at 14:26
  • Check out the answer to this question, you might be missing an IIS feature: stackoverflow.com/questions/9794985/… Jun 13, 2014 at 14:30
  • I think that this last comment of yours is the answer. I was just comparing the applicationHost.config files and noticed that the PC (referred to as Left PC above) is very bare. There are no comments and there are no overrideMode settings. I have no idea how this happened because I have not manually edited any of the config files. Somehow, the left PC's applicationHost.config did not get fully created or must have gotten altered somehow. Jun 13, 2014 at 14:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .