AI OnAI Off
The same problem occurs when going to
EPPi server CMS -> My settings -> User Informaton
and press the Save button.
I think I solved this mystery.
UserGuiSettings.SaveSettings() calls :
ProfileData orCreateProfile = this._profileRepository.get_Service().GetOrCreateProfile(userName);
In web.config I specified
<profile enabled="false">
<properties>
<clear />
</properties>
<providers>
<clear />
</providers>
</profile>
along with disabling of membership and roleManager sections
Reenabling profile section to something along these lines fixed the crash:
<profile enabled="true" defaultProvider="SqlProfileProvider" automaticSaveEnabled="true">
<properties>
<add name="Address" type="System.String" />
<add name="ZipCode" type="System.String" />
<add name="Locality" type="System.String" />
<add name="Email" type="System.String" allowAnonymous="true" />
<add name="FirstName" type="System.String" allowAnonymous="true" />
<add name="LastName" type="System.String" allowAnonymous="true" />
<add name="FullName" type="System.String" allowAnonymous="true" />
<add name="Language" type="System.String" />
<add name="State" type="System.Int32" allowAnonymous="false" />
<add name="Country" type="System.String" />
<add name="Company" type="System.String" />
<add name="Title" type="System.String" />
<add name="PreferredBillingAddress" type="System.String" />
<add name="PreferredShippingAddress" type="System.String" />
<add name="LastVisited" type="System.DateTime" />
<add name="SubscriptionInfo" type="EPiServer.Personalization.SubscriptionInfo, EPiServer" />
<add name="CustomExplorerTreePanel" type="System.String" />
<add name="FileManagerFavourites" type="System.Collections.Generic.List`1[System.String]" />
<add name="EditTreeSettings" type="EPiServer.Personalization.GuiSettings, EPiServer" />
<add name="ClientToolsActivationKey" type="System.String" />
<add name="FrameworkName" type="System.String" />
</properties>
<providers>
<clear />
<add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="EcfSqlConnection" applicationName="ProjectZAdmin" />
</providers>
</profile>
What puzzles me, is that Profile from the old membership framework still must be used along with the new AspNetIdentity, preserving the aspnet_Profile table in the Commerce database.
I am in the process of migrating several of our sites from Membership to MsIdentity. Thanks to the plethora of guides and walk-throughs, most of the work was relatively strait-forward. The site is set-up, existing test users and roles are migrated and I can log in. There are a couple snags, though. One of those is CMS Admin -> Create User.
I can enter the credentials for a new user and assign the roles. Clicking on the save button, I can see from Prefix profiling (see below) and a subsequent database verification that the new user is created using the Identity framework. However, at the end of the execution I get the following error and exception:
It seems that CreateUser is hardwired to Memebership, despite the Identity initialisation being in place. Is there some more configuration that needs to be in place for the Create User function to work properly?
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
SqlCommand.ExecuteReaderAsync SELECT AspNetUsers, Records: 1
Untracked Application Code
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
Untracked Application Code
SqlCommand.ExecuteReaderAsync SELECT AspNetUserClaims, Records: 0
Untracked Application Code
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
Untracked Application Code
SqlCommand.ExecuteReaderAsync SELECT AspNetUserLogins, Records: 0
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
Untracked Application Code
SqlCommand.ExecuteReaderAsync SELECT AspNetUserRoles, Records: 0
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
SqlCommand.ExecuteReaderAsync SELECT AspNetUsers, Records: 1
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
SqlCommand.ExecuteReaderAsync SELECT AspNetUsers, Records: 1
Untracked Application Code
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
Untracked Application Code
SqlCommand.ExecuteReaderAsync SELECT AspNetUserRoles, AspNetRoles, Records: 0
Untracked Application Code
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
Untracked Application Code
SqlCommand.ExecuteReaderAsync SELECT AspNetRoles, Records: 1
Untracked Application Code
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
SqlCommand.ExecuteReaderAsync SELECT AspNetUsers, Records: 1
SqlConnection.OpenAsyncvar-t-app01 | DressmannTestIdentity
SqlInternalConnection.BeginSqlTransaction
Untracked Application Code
SqlCommand.ExecuteNonQueryAsync UPDATE AspNetUsers, Records: 1
SqlCommand.ExecuteNonQueryAsync INSERT AspNetUserRoles, Records: 1
SqlInternalTransaction.Commit
Caught System.NullReferenceException