Installing the nuget for EPiServer GoogleAnalytics and virtual Roles
This is a short post and a reminder since I had trouble with installing the Google Analytics addon from EPiServer the other day.
They are looking for GoogleAnalyticsAdministrators that is supposed to be mapped to a specific group. But if you have not setup the website with these roles it will fail and the website will not start. Instead you will get the following error.
Serverfel i tillämpningsprogrammet /.
The list of roles for virtual role 'GoogleAnalyticsAdministrators' is not valid
Parameternamn: config
Beskrivning: Ett undantag som inte kunde hanteras uppstod när den aktuella webbegäran kördes. Mer information om felet och var i koden det uppstod finns i stackspårningen.
Undantagsinformation: System.ArgumentException: The list of roles for virtual role 'GoogleAnalyticsAdministrators' is not valid
Parameternamn: config
Källfel:
Ett undantag som inte hanteras genererades vid körningen av den aktuella webbegäran. Information om undantagets ursprung och plats kan identifieras med undantagsstackspårningen nedan.
Stackspårning:
[ArgumentException: The list of roles for virtual role 'GoogleAnalyticsAdministrators' is not valid
Parameternamn: config]
EPiServer.Security.MappedRole.Initialize(String name, NameValueCollection config) +545
EPiServer.GoogleAnalytics.InitializationModule.EnsureMappedRoleExists(VirtualRoleRepository`1 vrReposistory, String name, String roles) +153
EPiServer.GoogleAnalytics.InitializationModule.InitializeVirtualRoles() +558
EPiServer.GoogleAnalytics.InitializationModule.application_PostAuthenticateRequest(Object sender, EventArgs e) +5
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
Versionsinformation: Microsoft .NET Framework-version:4.0.30319; ASP.NET-version:4.0.30319.34212
Solution
Before you install you setup the groups WebEditors and WebAdmins in the CMS – Admin interface. Or you can add a virtualroles mapping in web.config for the specific groups.
<virtualRoles addClaims="true">
<providers>
<add name="Administrators" type="EPiServer.Security.WindowsAdministratorsRole, EPiServer.Framework" />
<add name="Everyone" type="EPiServer.Security.EveryoneRole, EPiServer.Framework" />
<add name="Authenticated" type="EPiServer.Security.AuthenticatedRole, EPiServer.Framework" />
<add name="Anonymous" type="EPiServer.Security.AnonymousRole, EPiServer.Framework" />
<add name="CmsAdmins" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="WebAdmins, Administrators" mode="Any" />
<add name="CmsEditors" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="WebEditors" mode="Any" />
<add name="GoogleAnalyticsAdministrators" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="Administrators" mode="Any" />
<add name="Creator" type="EPiServer.Security.CreatorRole, EPiServer" />
<add name="PackagingAdmins" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="WebAdmins, Administrators" mode="Any" />
</providers>
</virtualRoles>
Comments