Debug ProgramThe following error occurs: : The Section registered as allowdefinition = 'machinetoapplication' outside the application level is incorrect. This error may occur if the virtual directory is not configured as an application in IIS.
I have found many posts online to find the reasons. Some say
1. If no application name exists in IIS, create it first. If not, set C: \ WINDOWS \ Microsoft. net \ work \ v2.0.50727 \ config \ machine. change all allowdefinition = "machinetoapplication" in config to allowdefinition = "everywhere" 2. Right-click the virtual directory corresponding to the website, select properties, and click Create after the application name. I couldn't find it as they said. In the end, I understood that it was to point your virtual directory to the Web. config is in the folder, because Web. some configuration sections of config can only appear in the virtual directories and directories of the website. From: http://www.zgkw.net/FORUMS/blogs/lwr/archive/2007/04/26/29272.aspx
It's a good solution to use the 2 method.