Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Error Inserting Values to Roles...
kpcurley
#1 Posted : Tuesday, 26 July 2011 9:14:23 AM(UTC)
Rank: Member

Joined: 26/07/2011(UTC)
Posts: 6
Location: WRSG

Hello Roger - great interface!

I'm installing into an existing c# ASP.NET (4.0) project with pre-established ASP.NET Membership Provider. I thought I had manually configured the references to the current / separate membership database correctly, but am receiving the following error - I'm guessing when it is attempting to sync roles. The only problem is - it seems to be trying to push role data to our membership db - versus pull into the project db.

Here are the details:

Cannot insert the value NULL into column 'RoleId', table 'ASPNET_ASONS.dbo.aspnet_Roles'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'RoleId', table 'ASPNET_ASONS.dbo.aspnet_Roles'; column does not allow nulls. INSERT fails.
The statement has been terminated.

Source Error:

[No relevant source lines]

Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\sos_online\39883719\832ed445\App_Web_w312piaa.9.cs Line: 0

Stack Trace:


[SqlException (0x80131904): Cannot insert the value NULL into column 'RoleId', table 'ASPNET_ASONS.dbo.aspnet_Roles'; column does not allow nulls. INSERT fails.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +404
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1363
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6368941
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +6370642
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +538
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +689
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +327
System.Web.Security.SqlRoleProvider.CreateRole(String roleName) +1074
GalleryServerPro.Web.Controller.RoleController.CreateRole(String roleName) +194
GalleryServerPro.Web.Controller.UserController.ProcessInstallerFile() +408
GalleryServerPro.Web.Controller.GalleryController.InitializeApplication() +345
GalleryServerPro.Web.Controller.GalleryController.InitializeGspApplication() +437

[TypeInitializationException: The type initializer for 'GalleryServerPro.Web.Pages.GalleryPage' threw an exception.]
GalleryServerPro.Web.Pages.GalleryPage..ctor() +0
GalleryServerPro.Web.Pages.album..ctor() +17
ASP.gsp_pages_album_ascx..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\sos_online\39883719\832ed445\App_Web_w312piaa.9.cs:0
__ASP.FastObjectFactory_app_web_w312piaa.Create_ASP_gsp_pages_album_ascx() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\sos_online\39883719\832ed445\App_Web_w312piaa.11.cs:0
System.Web.UI.TemplateControl.LoadControl(IWebObjectFactory objectFactory, VirtualPath virtualPath, Type t, Object[] parameters) +235
System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) +205
GalleryServerPro.Web.Gallery.LoadRequestedPage() +203
System.Web.UI.Control.InitRecursive(Control namingContainer) +133
System.Web.UI.Control.InitRecursive(Control namingContainer) +421
System.Web.UI.Control.InitRecursive(Control namingContainer) +421
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1970





Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225

Here are the pertinent portions of the web.config as well:

<sectionGroup name="system.web">
<section name="galleryServerPro" type="GalleryServerPro.Configuration.GalleryServerProConfigSettings, GalleryServerPro.Configuration" allowDefinition="MachineToApplication" requirePermission="false" />
</sectionGroup>

...

<connectionStrings>
<remove name="LocalSqlServer" />
<add name="ASPNetConnectionString" connectionString="Data Source=WRSGDEV***;Initial Catalog=ASPNET_ASONS;Persist Security Info=True;User ID=SOS_AspNet*****;Password=*****" providerName="System.Data.SqlClient" />
<!-- BEGIN: GSP - Addition -->
<!-- <add name="SqlServerCeGalleryDb" providerName="System.Data.SqlServerCe.4.0" connectionString="data source=|DataDirectory|\GalleryServerPro_Data.sdf" /> -->
<add name="SqlServerDbConnection" connectionString="server=WRSGDev**** uid=ASONS_*** pwd=*****;Trusted_Connection=no;database=Asons_SOS20;Application Name=ASONS20" />
<!-- <add name="SqlServerDbConnection" connectionString="Data Source=WRSGDEVS01;Initial Catalog=ASONS_SOS20;Persist Security Info=True;User ID=ASONS_***;Password=*****;Application Name=ASONS20" providerName="System.Data.SqlClient" /> -->
<!-- END: GSP - Addition -->
</connectionStrings>

...

<galleryServerPro>
<core galleryResourcesPath="gsp" />
<dataProvider defaultProvider="SqlServerGalleryServerProProvider">
<providers>
<clear />
<add applicationName="Gallery Server Pro" connectionStringName="SqlServerDbConnection" name="SqlServerGalleryServerProProvider" type="GalleryServerPro.Data.SqlServer.SqlDataProvider" />
</providers>
</dataProvider>
</galleryServerPro>

...

<membership defaultProvider="ASPNetSqlMembershipProvider" userIsOnlineTimeWindow="20">
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ASPNetConnectionString" applicationName="ASONS20" enablePasswordRetrieval="false" enablePasswordReset="true" passwordFormat="Hashed" requiresUniqueEmail="false" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" />
<!-- <add applicationName="Gallery Server Pro" name="SqlCeMembershipProvider" connectionStringName="SqlServerCeGalleryDb" passwordFormat="Clear" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="2" maxInvalidPasswordAttempts="50" enablePasswordReset="true" enablePasswordRetrieval="true" passwordAttemptWindow="10" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" type="GalleryServerPro.Data.SqlCe.SqlCeMembershipProvider" />
<add applicationName="Gallery Server Pro" name="SqlMembershipProvider" connectionStringName="SqlServerDbConnection" passwordFormat="Clear" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="2" maxInvalidPasswordAttempts="50" enablePasswordReset="true" enablePasswordRetrieval="true" passwordAttemptWindow="10" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" type="System.Web.Security.SqlMembershipProvider" />
-->
</providers>
</membership>
<!--<roleManager enabled="true" />-->
<roleManager enabled="true" cacheRolesInCookie="false" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" defaultProvider="AspNetSqlRoleProvider" createPersistentCookie="false">
<providers>
<remove name="AspNetSqlRoleProvider" />
<add name="AspNetSqlRoleProvider" connectionStringName="ASPNetConnectionString" applicationName="ASONS20" type="System.Web.Security.SqlRoleProvider" />
</providers>
</roleManager>

Again, with the config settings above, our core application interface works fine, but we receive the error message listed above.

Any guidance is appreciated as I'd like to stage for demo to a client this afternoon.

Thanks!

-Keith
Roger Martin
#2 Posted : Tuesday, 26 July 2011 9:32:40 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

The stack trace tells me that the install wizard is trying to finish the final step of creating a System Administrator role. If you don't want that, delete the file SqlMembership.txt (or something like that) from your App_Data directory.

The end result will be that you need to choose an existing role to use to hold sys admin privileges, then find that role in the gs_Role table and make sure the AllowAdministerSite column is set to true (1). And of course you'll need to make sure one of your accounts is in this role (table aspnet_UsersInRoles). Finally, restart the IIS app pool.

Since you are under a tight time crunch, feel free to call me at 920-563-3165 if you want any more help.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
kpcurley
#3 Posted : Tuesday, 26 July 2011 9:44:53 AM(UTC)
Rank: Member

Joined: 26/07/2011(UTC)
Posts: 6
Location: WRSG

Thanks Roger - I'll give that a try and contact you if issues continue. I'm OK with covering your time if I need help to complete this afternoon. Its appreciated!

-Keith
kpcurley
#4 Posted : Tuesday, 26 July 2011 10:05:30 AM(UTC)
Rank: Member

Joined: 26/07/2011(UTC)
Posts: 6
Location: WRSG

OK - Install.txt was removed - so it looks like the initial install process went OK. I believe GSP is attempting to perform an initial sync to the asp.net membership provider - but is attempting to stuff roles into our provider versus pulling them back into the local gs_role table. So, I'm wondering if I have one of the GSP DB references missing or pointing at the wrong source in my various web.config strings provided above.

I manually created a rolename to mirror our superadmin account and provided full admin privileges (and restarted iis), but no luck.

This is all in my local dev environment on my local system (db is on our dev MS-SQL Server) for initial staging before staging to our server for demo.

Any more thoughts before we escalate?

Thanks,

-Keith
Roger Martin
#5 Posted : Tuesday, 26 July 2011 10:11:56 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

Removing Install.txt won't help the initial error you were posting (although it is good to do anyway). Notice I said to delete a file named something like SqlMembership.txt.

Have you done that and then restarted IIS? If so, any errors you subsequently get should have a different stack trace, so post that and we can go from there. Or just call me...
Roger Martin
Creator and Lead Developer of Gallery Server Pro
kpcurley
#6 Posted : Tuesday, 26 July 2011 10:14:50 AM(UTC)
Rank: Member

Joined: 26/07/2011(UTC)
Posts: 6
Location: WRSG

OK - yeah - up to Insufficient Permissions!

It seems our ASP.NET Membership Provider Table was missing the (newid()) default for RoleID as it was migrated from our production environment for testing and was missing default settings.

With that fixed - we're up to setting privileges. I manually updated our super admin role in gs_role with full privileges and reran - unfortunately, still insufficient permission.

Thanks,

-Keith
Roger Martin
#7 Posted : Tuesday, 26 July 2011 10:20:08 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

You are almost there... Did you restart IIS? Are you logging on with a user in that role?
Roger Martin
Creator and Lead Developer of Gallery Server Pro
kpcurley
#8 Posted : Tuesday, 26 July 2011 10:28:44 AM(UTC)
Rank: Member

Joined: 26/07/2011(UTC)
Posts: 6
Location: WRSG

Excellent - OK, it needed the final IIS Restart. Seems to be where we had it in a prior test on DNN 5.6+, but now in our custom interface. I'll work through the interface to setup for demo and catch you with any follow-on questions.

Thanks for your help!

-Keith
Rss Feed  Atom Feed
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.