maartenba / MvcSiteMapProvider

An ASP.NET MVC SiteMapProvider implementation for the ASP.NET MVC framework.
Microsoft Public License
537 stars 220 forks source link

Duplicate (no?) `scriptResourceHandler` section defined #429

Closed mwpowellhtx closed 8 years ago

mwpowellhtx commented 8 years ago

Hello,

I added MvcSiteMapProvider out of the box to support sitemaps in my application.

I already have some Autofac being wired up, including replacing the default root with that of the Autofac container.

Now I am receiving this error after adding the provider.

Basically, I think I am looking for basic starting examples of the Web.config.

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module     IIS Web Core
Notification       Unknown
Handler    Not yet determined
Error Code     0x8007000d
Config Error       
Config File    \\?\D:\Source\...\web.config
Requested URL      http://localhost:7881/
Physical Path      
Logon Method       Not yet determined
Logon User     Not yet determined
Request Tracing Directory      C:\Users\...\Documents\IISExpress\TraceLogFiles\
Config Source:

   -1: 
    0: 

More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.

If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.

View more information »

Thank you...

mwpowellhtx commented 8 years ago

Turns out it was an error in my Web.config. Some examples of the config would still be helpful, like how to specify providers, defaults, etc, etc.

NightOwl888 commented 8 years ago

The default configuration is documented here. However, as you mentioned you are using a DI module, the only applicable setting is

<add key="MvcSiteMapProvider_UseExternalDIContainer" value="true"/>

All other settings are provided by the DI module (unless you want to put them into web.config, but that is up to you).

mwpowellhtx commented 8 years ago

Are any of these necessary?

    <add key="MvcSiteMapProvider_IncludeAssembliesForScan" value="Football.Web.AspNet" />
    <add key="MvcSiteMapProvider_UseExternalDIContainer" value="true" />
    <add key="MvcSiteMapProvider_ScanAssembliesForSiteMapNodes" value="true" />

For instance, I see these represented in the Autofac Module.