1

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...

Jorg Ancrath
  • 1,447
  • 10
  • 34
  • 61
  • `\jdlferre\public_html\orangefresh\web.config` is this not a file you have control over? – Red Taz Aug 20 '12 at 11:00
  • Yes, I have control over it... it's the only web.config file in my website. – Jorg Ancrath Aug 20 '12 at 11:02
  • When you say you don't use IIS, how are you hosting a website online without IIS? – Dark Hippo Aug 20 '12 at 11:02
  • you have place this web.config to a subdirectory and there you can not use this option – Aristos Aug 20 '12 at 11:04
  • DarkHippo: I don't know what you mean (and that is very likely my fault - this is my first ever ASP.NET project that I try to host), I don't know anything about IIS really, I don't have anything IIS on my computer and I used Filezilla to upload my website. Aristos: I didn't understand you there, my web.config is on a subdirectory?... – Jorg Ancrath Aug 20 '12 at 11:09
  • You don't need IIS on your computer. IIS is the program that the hosting provider will use to run the website on the server you uploaded it to. – Dark Hippo Aug 20 '12 at 11:13
  • I think Aristos is asking if your web.config is in a sub-directory or in the root of your site. So looking at the URL above, you have the public_html folder, then the orangefresh sub folder. Does the orangefresh subfolder contain all of your website code? – Dark Hippo Aug 20 '12 at 11:15
  • Yes, the web.config file in in the root folder, all the files and folders for my website are in the orangefresh folder. – Jorg Ancrath Aug 20 '12 at 11:24
  • Are there any files in the public_html folder besides the orangefresh folder? If not, try moving all the files to there – Dark Hippo Aug 20 '12 at 11:28
  • 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. – Jorg Ancrath Aug 20 '12 at 11:32
  • I have this on my web.config file: , I tried changing my ASP.NET version from 2.0 to 4.0 on my hosts cPanel, still getting the error though... – Jorg Ancrath Aug 20 '12 at 11:39

2 Answers2

0

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.

Red Taz
  • 4,159
  • 4
  • 38
  • 60
  • Well, locally I don't have issues, about replicating the environment - do you mean placing a web.config file a folder or so above my website folder? I've tried that just now without a problem... – Jorg Ancrath Aug 20 '12 at 11:13
  • Yes, the top-level web.config will likely have a lot of default configuration sections in it. I would try including a default config file generated by visual studio in a root folder and then place your website in a subfolder within that. – Red Taz Aug 20 '12 at 11:17
  • To clarify, once you have that setup, you should only upload your website to the host (not the top-level config file) – Red Taz Aug 20 '12 at 11:23
  • I just attempted this locally and my website still runs fine... placed a default web.config file a folder above my project, no problem whatsoever... I opened up my website once on the new Visual Studio 2012 trial, it gave me a message about IIS versions, could this have anything to do with my problem? – Jorg Ancrath Aug 20 '12 at 11:29
  • You will have to move various sections out of your website config file and into the top-level such as `` and `` – Red Taz Aug 20 '12 at 11:40
0

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.

Dark Hippo
  • 1,255
  • 2
  • 15
  • 35