error in GetWebConfigCommand [Answered]RSS

5 replies

Last post Sep 04, 2011 10:58 PM by NickBourke

  • error in GetWebConfigCommand

    Jan 17, 2011 12:49 AM|jijizz|LINK

    This is a question around IIS powershell snapin (webadministration). I run   Get-WebConfigFile 'IIS:\Sites\SharePoint - 80' Gives me error:Get-WebConfigFile : Filename: \\?\D:\inetpub\wwwroot\wss\VirtualDirectories\twcmbmfarm280\web.config
    Line number: 742
    Error: The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration
    At line:1 char:18
    + Get-WebConfigFile <<<< 'IIS:\Sites\SharePoint - twcmbmfarm280'
        + CategoryInfo : NotSpecified: (:) [Get-WebConfigFile], COMException
        + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.GetWebConfigCommand
     This only happens when IIS site is registered with .Net4 and does not repro in a .Net 3.5 machine I am using IIS7, win2008 R2, .Net 4.Please let me know if you have any idea about this failure.

     

  • Re: error in GetWebConfigCommand

    Jan 19, 2011 12:47 AM|Lloydz|LINK

    Hi,

    The problem is probably that you are running a .net 4.0 application under an application pool which loads .net framework version 2.0. Would you please change the applicationpool's .net version to 4.0 to see if this fix the problem?

    Thanks

     

  • Re: error in GetWebConfigCommand

    Jan 20, 2011 03:05 PM|jijizz|LINK

    The .net framework version is already 4.0 for my app pool, otherwise, my site can not render.

    I am wondering if webadministration snapin is updated to work correctly with .net 4.0.

  • Re: error in GetWebConfigCommand

    Jan 20, 2011 10:38 PM|Lloydz|LINK

    It should work with .net 4.0. Since the error shows "The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration". Could you also please check does the following declaration exist in the machine.config file.

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

    Note: The machine.config file locates at "%SystemDrive%\Windows\Microsoft.NET\Framework\v4.0.30319\Config".

    Hope this helps, thanks.

  • Re: error in GetWebConfigCommand

    Jan 24, 2011 03:46 AM|jijizz|LINK

    Yes, this is copied from mine, which I believe is the same as yours.

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

  • Re: error in GetWebConfigCommand

    Sep 04, 2011 10:58 PM|NickBourke|LINK

    It's been a while since this was asked, but I recently encountered the same problem in one of our test environments.

    After reinstalling .NET 4.0, reinstalling IIS etc, we eventually found the problem to be that .NET 3.5 had not been installed on the machine. Installing this resolved the problem.

    Hope this helps someone else in the same situation.