none
error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    Question

  • I have a WCF Rest service that was created in VS2008 in Win XP, now moving it to VS2010 in Win8. It errors:

    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.

    The website/project has 3 subfolders, each has a (different) service.svc & web.config; the parent folder has a web.config as well. In IIS 8, I created a site for the parent folder. At different times, I created an application or virtual directory within the site, was not able to get rid of this error. Although I knew it would not be correct, I also created 1 virtual directory for each sub folder once. That didn't solve the problem. I also read about deleting the old obj folder, which didn't work.

    Can someone help? Thanks!

    Tuesday, June 18, 2013 1:15 AM

All replies

  • Hi,

    Do you try with a Build Clean command with Visual Studio 2010 and then rebuild?

    http://www.sellsbrothers.com/posts/details/12673

    If this does not work, please check the virtual directory setting in IIS manager to make sure it is a an application virtual directory(not a normal virtual directory) as suggested here.

    #Understanding Sites, Applications, and Virtual Directories on IIS 7
    http://www.iis.net/learn/get-started/planning-your-iis-architecture/understanding-sites-applications-and-virtual-directories-on-iis#About7.0

    Hope this helps.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 19, 2013 3:41 AM
    Moderator
  • Haixia, thanks for your reply!

    This is a WCF website. No clean build. I actually didn't know about clean. When I created a new project in VS 2010, I could see the option. Then I added the existing website to the solution, clean was just not an option for the website.

    Thanks for giving the different ref links! I read through each of them, and the links from those. In IIS 8, I do have an application pool: physical path is the website root folder; site is the site I created under Sites. It looks right to me...

    If I click on the error from rebuild solution, it points this line in the web.config in a subfolder:<serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> under<system.serviceModel>

    But allowDefinition="MachineToApplication" is specified in the web.config in the root folder:

        <configSections>
            <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                        <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
                        <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                        <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                        <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup>
          </sectionGroup>
        </configSections>

    Is there a conflict in web.config's by IIS 8 standard?



    Wednesday, June 19, 2013 11:28 PM