an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Support > Installation > Migrating Db from dev to prod environments.
Last Post 3/23/2009 6:29:25 PM By jodakilag. 4 replies.
2/20/2009 8:34:26 AM
asmith
Posts: 2
Joined: 2/20/2009
Migrating Db from dev to prod environments.
I'm having trouble migrating an existing db from our dev environment to our prod environment. I have backed up the existing db and restored it to a new db instance on the same machine. I have two instances of DSC on two different machines. The problem is if I point the prod instance of DSC to the newly created DB instance I get the following error:
 
Type : System.Security.Cryptography.CryptographicException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Padding is invalid and cannot be removed.
Source : mscorlib
 
I believe this is caused by DotshoppingcartMaster.key issues. Now I can't copy the DotshoppingcartMaster.key from the dev environment to the prod environment or I get the following error: 
 
Type : System.Security.Cryptography.CryptographicException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Key not valid for use in specified state.
 
What I need to know is how can I copy an existing DB for use with another instance of DSC and not run into Crypto problems? I really don't want to start fresh and re-add all of my items and other customizations.
 
Any pointers?

 
2/20/2009 9:11:37 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Migrating Db from dev to prod environments.
This is exactly what the encryption key was designed for. Moving db out of machine alone you won't expose the critical data from the database.
 
Read this and this. Basically you will need to expose the key from the dev machine and import the key to the prod machine.
DotShoppingCart Staff
2/20/2009 9:43:40 AM
asmith
Posts: 2
Joined: 2/20/2009
Re: Migrating Db from dev to prod environments.
Thank you! Worked like a charm.
3/23/2009 5:22:34 PM
jodakilag
Posts: 3
Joined: 3/23/2009
Re: Migrating Db from dev to prod environments.
We are having the same issue, unfortunately generating a new key and updating the web.config didn't fix the problem.
 
<span> 

Server Error in '/' Application. <hr width="100%" color="#c0c0c0" size="1" />

Padding is invalid and cannot be removed.

</span>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.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.

Source Error:

<table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td>
Line 44:                 DSC.User user = DSC.User.GetUser(Page.User.Identity.Name);
Line 45:                 adiBilling.InitialAddressToDisplay = user.Address;
Line 46:                 List<CreditCard> creditCards = CreditCard.Get();
Line 47:                 if ((null != creditCards) && (creditCards.Count > 0)) {
Line 48:                     PopulateEmptySaveAs(creditCards);
</td> </tr> </tbody> </table>
3/23/2009 6:29:25 PM
jodakilag
Posts: 3
Joined: 3/23/2009
Re: Migrating Db from dev to prod environments.
Hi All,
 
I have figured out the problem... the credit cards (test ones) we have on the database is causing the problems. I deleted the credit cards in the creditcard table and all is fine now.
 
Thanks,
Jojo