6

I'm developing an application in MVC3 (http://www.colombiatrolley.com/sitrolley). In my computer it runs correctly, but when I upload it to the server (a hosting service) I get this error:

Parser Error Message: 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.

I know it is a very common error but I have not fixed it yet.

Error capture

Miguel Jiménez
  • 1,276
  • 1
  • 16
  • 24

2 Answers2

3

Some config sections are only allowed at the "root" of the application, then authentication section is one of them.

You need to configure IIS to run your your site as an application, not a sub-directory in an existing application.

For IIS 7+, right click the directory that contains your web application, and select "Convert to Application".

EDIT:

Arie van Someren is right. Looking carefully at your error, you want the <authentication> configuration to be in the web.config one level up, not the web.config in Views.

vcsjones
  • 138,677
  • 31
  • 291
  • 286
  • It only appears that option (Convert to Application) for the subdirectories, like "Views". I´ve already clicked on it but the error remains. Do you have another possible answer? – Miguel Jiménez Mar 01 '12 at 03:20
  • 2
    Do you have the tag in the web.config inside your Views subfolder? This might explain the exception. – Arie van Someren Mar 01 '12 at 19:04
  • 1
    @migueljimenezz @`ArievanSomeren is right, you want your authentication element to be on the web.config one level up. – vcsjones Mar 01 '12 at 19:23
1

I had the same problem. I solved it by deleting the obj folder that appeared after doing a "Build > Publish".

Tarzan
  • 4,270
  • 8
  • 50
  • 70