allowDefinition='MachineToApplication' error only on my hosted website

1.6k Views Asked by At

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.

Line 10: </connectionStrings>
Line 11: <system.web>
Line 12: <roleManager enabled="true" />
Line 13: <membership>
Line 14: <providers>

Source File: \Ns2\f\Users\cPanel\jdlferre\public_html\orangefresh\web.config
Line: 12

I've looked around the internet with no luck, I don't have any other web.config files on my subfolders, or even anywhere on my website. I don't use IIS so I've scratched that out too...

My website runs fine locally, it's only online that I get this error...

2

There are 2 best solutions below

5
On

I would presume that your host is running your site within a sub folder of a website. The website will have a top level web.config in it, various sections of your web.config will then conflict with the parent configuration file.

I would suggest you try replicating that environment locally.

4
On

Ok, that now gives me a "Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive." This is also what happened when I tried moving my web.config file around. – Joao Ferreira 1 min ago

That sounds to me like you're trying to run a .Net 4 or above website under a hosting provider that only supports .net 3.5

You can check by right clicking on the website root in Visual Studio, then going to "property pages" then click "build" (note: that's in VS2010, I don't have 2012, but it's probably quite similar). That should give you target framework information.

If you're using VS2012, then it probably creates a .Net 4 website by default, so it'll probably say .NET Framework 4.

If you're not using any controls that need .Net 4 or above, you can rebuild it in 3.5 and see if that solves the problem.

Otherwise, check with your hosting company to make sure they do host .Net 4 sites. Not all of them do, I've come across that exact problem a couple of months ago.