Failed to decrypt using provider: Developing on a second PC
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 32
- Joined: Mon Jan 28, 2008 10:05 am
Failed to decrypt using provider: Developing on a second PC
Hi,
First off, AbleCommerce is a great product it's really - it's really making my life easier at work!
Today however, i'm working from home while I wait for the kitchen fitters who were meant to be here 40 minutes ago to turn up. I have taken a direct copy of the ablecommerce site from my work's development machine, along with the .mdf file for the database.
These are now setup, and in place on my home development machine. When I attempt to run the site, I recieve the following message;
'Failed to decrypt using provider 'DataProtectionConfigurationProvider'. Error message from the provider: Key not valid for use in specified state. (Exception from HRESULT: 0x8009000B)'
I assume this means that some of my local settings don't match what AbleCommerce was expecting for this instance of the codebase and it's rather politely telling me to shove off.
Both machines are running on localhost, to which my copy of ablecommerce is bound. I am in the UK, and my locale settings at home are UK English, I am sure that this is also the case at work but I can't confirm for certain right now.
Is there any fix for this, even if it's temporary - like I say I only need to be working from home today so a temporary fix would be more than enough!
Thanks a lot for any help you can offer,
Dave.
-----
edit to add this error occurs in App_Data/database.config
First off, AbleCommerce is a great product it's really - it's really making my life easier at work!
Today however, i'm working from home while I wait for the kitchen fitters who were meant to be here 40 minutes ago to turn up. I have taken a direct copy of the ablecommerce site from my work's development machine, along with the .mdf file for the database.
These are now setup, and in place on my home development machine. When I attempt to run the site, I recieve the following message;
'Failed to decrypt using provider 'DataProtectionConfigurationProvider'. Error message from the provider: Key not valid for use in specified state. (Exception from HRESULT: 0x8009000B)'
I assume this means that some of my local settings don't match what AbleCommerce was expecting for this instance of the codebase and it's rather politely telling me to shove off.
Both machines are running on localhost, to which my copy of ablecommerce is bound. I am in the UK, and my locale settings at home are UK English, I am sure that this is also the case at work but I can't confirm for certain right now.
Is there any fix for this, even if it's temporary - like I say I only need to be working from home today so a temporary fix would be more than enough!
Thanks a lot for any help you can offer,
Dave.
-----
edit to add this error occurs in App_Data/database.config
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
The database.config file is encrypted - this encryption is machine specific. The file that you have copied from work cannot be decrytped by your machine at home. It's relatively easy to fix.
Open up the App_Data/database.config file. Inside is going to be a bunch of goggledegook that is the encrypted connection string. Replace the entire contents of the file with the code below. I assume you are using a local user instance of SQL Express, so that is how this sample is configured. If that is not correct, update the connection string to point to your database.
Open up the App_Data/database.config file. Inside is going to be a bunch of goggledegook that is the encrypted connection string. Replace the entire contents of the file with the code below. I assume you are using a local user instance of SQL Express, so that is how this sample is configured. If that is not correct, update the connection string to point to your database.
Code: Select all
<connectionStrings>
<add name="AbleCommerce" connectionString="Data Source=.\SQLExpress;Integrated Security=True;AttachDbFileName=|DataDirectory|\AbleCommerce.mdf;User Instance=true;" providerName="System.Data.SqlClient" />
</connectionStrings>
Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 32
- Joined: Mon Jan 28, 2008 10:05 am
-
- Commander (CMDR)
- Posts: 121
- Joined: Wed Dec 17, 2008 9:13 am
Re: Failed to decrypt using provider: Developing on a second PC
We have configured ablecommerce on our Developement server. I did an XCopy of those code folders on to my local PC and configured on my IIS server as local site , so that I can view those file in visual studio and do customization we need to in those files.
After I configured and accessed login.aspx page it gave me error configProtectionProvider="DataProtectionConfigurationProvider"
I read above post and removed encrypted data and added connectionstring like this
<connectionStrings >
<add name="AbleCommerce" connectionString="Data Source=dev2\SQL2005;Integrated Security=True;Database=Ablecommerce;User Instance=true;" providerName="System.Data.SqlClient" />
</connectionStrings>
I want my local application to use ablecommerce database installed on our dev server, so that any modifications will be in one place and all our developers can use the same database.
Anyways.....I get update license key page. Sure we don't have license key for my local pc, but development server has a valid key.
How can I over this to work on my local PC?
Please help
thanks,
Carol
After I configured and accessed login.aspx page it gave me error configProtectionProvider="DataProtectionConfigurationProvider"
I read above post and removed encrypted data and added connectionstring like this
<connectionStrings >
<add name="AbleCommerce" connectionString="Data Source=dev2\SQL2005;Integrated Security=True;Database=Ablecommerce;User Instance=true;" providerName="System.Data.SqlClient" />
</connectionStrings>
I want my local application to use ablecommerce database installed on our dev server, so that any modifications will be in one place and all our developers can use the same database.
Anyways.....I get update license key page. Sure we don't have license key for my local pc, but development server has a valid key.
How can I over this to work on my local PC?
Please help
thanks,
Carol
-
- Commander (CMDR)
- Posts: 121
- Joined: Wed Dec 17, 2008 9:13 am
Re: Failed to decrypt using provider: Developing on a second PC
Just an addition.
I replace connectionstring with valid credentials and now I get
Server Error in '/Ablecommerce_MUP' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
CommerceBuilder.Services.AbleCommerceHttpModule.Init(HttpApplication context) +85
System.Web.HttpApplication.InitModulesCommon() +65
System.Web.HttpApplication.InitModules() +43
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289
I replace connectionstring with valid credentials and now I get
Server Error in '/Ablecommerce_MUP' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
CommerceBuilder.Services.AbleCommerceHttpModule.Init(HttpApplication context) +85
System.Web.HttpApplication.InitModulesCommon() +65
System.Web.HttpApplication.InitModules() +43
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Failed to decrypt using provider: Developing on a second PC
On the first line of your ablecommerce.config file add demoMode="true"Anyways.....I get update license key page. Sure we don't have license key for my local pc, but development server has a valid key.
How can I over this to work on my local PC?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
-
- Commander (CMDR)
- Posts: 121
- Joined: Wed Dec 17, 2008 9:13 am
Re: Failed to decrypt using provider: Developing on a second PC
I don't see any section in ablecommerce.config where I can write demomode="true"
what would be that <add key="?" demomode="true"/>
Please let me know
I can see in license.aspx , license type is being retrieved from
CommerceBuilder.Configuration.License lic = Token.Instance.License;
LicenseType.Text = (lic.IsDemo ? "DEMO" : "LIVE");
what would be that <add key="?" demomode="true"/>
Please let me know
I can see in license.aspx , license type is being retrieved from
CommerceBuilder.Configuration.License lic = Token.Instance.License;
LicenseType.Text = (lic.IsDemo ? "DEMO" : "LIVE");
Re: Failed to decrypt using provider: Developing on a second PC
It is an attribute on the <application> element, as inCarolharry wrote:I don't see any section in ablecommerce.config where I can write demomode="true"
what would be that <add key="?" demomode="true"/>
Code: Select all
<application demoMode="true" ...>
-
- Commander (CMDR)
- Posts: 121
- Joined: Wed Dec 17, 2008 9:13 am
Re: Failed to decrypt using provider: Developing on a second PC
<application enableRewrite="true" demoMode="true" connectionStringName="" maintenanceInterval="360" viewStateWarning="0" readOnlyInstance="false">
I added this in ablecommerce.config, still it doesn't work.
It's something to do with the database connection string. On server the connectionstring in database.config is encrypted.
That encrypted tag is not working on my computer. It's giving me error saying unable to decrypt.
Hence I wrote normal database connectionstring with servername,userid and password.
Then it gives me "Object not set to reference or null reference"
It's frustrating.
Does anyone has a document of steps to follow for succesfully configuring on PC for developing for developers.
Please help
Thanks,
Carol
I added this in ablecommerce.config, still it doesn't work.
It's something to do with the database connection string. On server the connectionstring in database.config is encrypted.
That encrypted tag is not working on my computer. It's giving me error saying unable to decrypt.
Hence I wrote normal database connectionstring with servername,userid and password.
Then it gives me "Object not set to reference or null reference"
It's frustrating.
Does anyone has a document of steps to follow for succesfully configuring on PC for developing for developers.
Please help
Thanks,
Carol
Re: Failed to decrypt using provider: Developing on a second PC
My guess is the null reference is caused by a failing connection to the database.
Here's what I did to setup my workstation for development.
1. Requested a developer key from AbleCommerce.
2. Installed AbleCommerce using my developer key.
3. Verified that the website ran correctly.
4. Launched Visual Studio and select File > Open Website > selected the website (actually the virtual directory since I installed to virtual directory).
Some things that can go wrong:
- AC keys exactly match the website. For example, a key for http://www.company.com will not work on localhost. Similarly a key for localhost will not work for 127.0.0.1 even though they both ultimately point to the same box. However, even if you enter the wrong key or no key, setting demoMode="true" in the config file will allow the store to run.
- Do not create a web application in Visual Studio (I think that is what it is called). There are lot's of namespace collisions which will break the build. Just use the File > Open Website dialog and let VS create a website project.
Here's what I did to setup my workstation for development.
1. Requested a developer key from AbleCommerce.
2. Installed AbleCommerce using my developer key.
3. Verified that the website ran correctly.
4. Launched Visual Studio and select File > Open Website > selected the website (actually the virtual directory since I installed to virtual directory).
Some things that can go wrong:
- AC keys exactly match the website. For example, a key for http://www.company.com will not work on localhost. Similarly a key for localhost will not work for 127.0.0.1 even though they both ultimately point to the same box. However, even if you enter the wrong key or no key, setting demoMode="true" in the config file will allow the store to run.
- Do not create a web application in Visual Studio (I think that is what it is called). There are lot's of namespace collisions which will break the build. Just use the File > Open Website dialog and let VS create a website project.
-
- Commander (CMDR)
- Posts: 121
- Joined: Wed Dec 17, 2008 9:13 am
Re: Failed to decrypt using provider: Developing on a second PC
Hi Andy,
Thank you for the pointers. I sent email for ablecommerce to give an developer license key.
Meanwhile , where is the place i write demomode=true
I wrote this <application enableRewrite="true" demoMode="true" connectionStringName="" maintenanceInterval="360" viewStateWarning="0" readOnlyInstance="false">
<trackPages enabled="true" ignoreHandlers="WithStandardExtensions" defaultState="On">
in applicatin section in Ablecommerce.config.
But it isn't working.
Thank you,
Carol
Thank you for the pointers. I sent email for ablecommerce to give an developer license key.
Meanwhile , where is the place i write demomode=true
I wrote this <application enableRewrite="true" demoMode="true" connectionStringName="" maintenanceInterval="360" viewStateWarning="0" readOnlyInstance="false">
<trackPages enabled="true" ignoreHandlers="WithStandardExtensions" defaultState="On">
in applicatin section in Ablecommerce.config.
But it isn't working.
Thank you,
Carol
Re: Failed to decrypt using provider: Developing on a second PC
That's where you put it. In a previous post you said a null reference exception was appearing. That has nothing to do with demoMode. It may mean your website cannot connect to the database. But is could also mean about 1 million other things. This is a good time to pull out your mad debugging skills and narrow down the possibilities.
-
- Commander (CMDR)
- Posts: 121
- Joined: Wed Dec 17, 2008 9:13 am
Re: Failed to decrypt using provider: Developing on a second PC
Thank you everyone for helping with the tips.
Procedure written by "afm" to configure on local pc is the right one.
Writing <application demoMode=true> in application tag "ABLECOMMERCE.CONFIG" mentioned by "Ablecommerce Angel"
also worked
By debugging and eliminiating some connectionstring attributes I was able to run my application.
In future if someone runs into problem like this , u can even try changing connection string like this
FROM
<connectionStrings >
<add name="Ablecommerce" connectionString="Data Source=dev2\SQL2005;Database=Ablecommerce;User Instance=true;Integrated Security=true" providerName="System.Data.SqlClient" />
</connectionStrings>
TO
<connectionStrings >
<add name="Ablecommerce" connectionString="Data Source=dev2\SQL2005;Database=Ablecommerce;User=xxx;password=xxx;" providerName="System.Data.SqlClient" />
</connectionStrings>
Thank you all once again
Carol
Procedure written by "afm" to configure on local pc is the right one.
Writing <application demoMode=true> in application tag "ABLECOMMERCE.CONFIG" mentioned by "Ablecommerce Angel"

By debugging and eliminiating some connectionstring attributes I was able to run my application.
In future if someone runs into problem like this , u can even try changing connection string like this
FROM
<connectionStrings >
<add name="Ablecommerce" connectionString="Data Source=dev2\SQL2005;Database=Ablecommerce;User Instance=true;Integrated Security=true" providerName="System.Data.SqlClient" />
</connectionStrings>
TO
<connectionStrings >
<add name="Ablecommerce" connectionString="Data Source=dev2\SQL2005;Database=Ablecommerce;User=xxx;password=xxx;" providerName="System.Data.SqlClient" />
</connectionStrings>
Thank you all once again
Carol
Last edited by Carolharry on Fri Jan 30, 2009 2:23 pm, edited 1 time in total.
Re: Failed to decrypt using provider: Developing on a second PC
Cool!
Just to close the loop, "User Instance=true" tells the SqlClient that Data Source is a physical file in the path you specified ("dev\SQL2005"). Since you are connecting to a server, not an SQL Express file, you either set User Instance=false or remove it (the default is false).
And "Integrated Security=true" tells the client to use the identity of the IIS application pool to connect to the database. Typically that identity is "NETWORK SERVICE" or "ASPNET". So you can either add the identity to the SQL Server logons, or use the server username/password like you did.
Here is a great site for decyphering connection strings,
http://www.connectionstrings.com
Just to close the loop, "User Instance=true" tells the SqlClient that Data Source is a physical file in the path you specified ("dev\SQL2005"). Since you are connecting to a server, not an SQL Express file, you either set User Instance=false or remove it (the default is false).
And "Integrated Security=true" tells the client to use the identity of the IIS application pool to connect to the database. Typically that identity is "NETWORK SERVICE" or "ASPNET". So you can either add the identity to the SQL Server logons, or use the server username/password like you did.
Here is a great site for decyphering connection strings,
http://www.connectionstrings.com