I noticed a strange problem when FTP publishing my ASP.NET MVC application in Visual Studio:
After publication, it will not compile. I get this error:
An error occurred while using a section registered as allowDefinition = 'MachineToApplication' that is higher than the application level. This error can be caused by the fact that the virtual directory is not configured as an application in IIS.
From my research so far, this error usually occurs when a Web.config file containing certain sections is deeper than root in the project folder hierarchy.
Well, it turns out I have some Web.config files deeper in the hierarchy that I found in these folders:
- [project folder] \ obj \ Release \ Package \ PackageTmp
- [project folder] \ obj \ Release \ TransformWebConfig \ original
- [project folder] \ obj \ Release \ TransformWebConfig \ transform
The problem is that I did not place these files in these places. They are copied there during the publishing process (in particular, FTP publish). If I manually delete Web.configs (or rebuild my solution), I can compile again. (Well, rebuilding usually works β it wonβt work if I switch from Debug to Release or vice versa after posting.)
Now, to my questions:
Am I messing up the setup or doing something wrong or is it basically just a nuisance that I have to deal with? Should I be bothered? Is this problem fixed?
source share