aspnet_regiis fails (0x80131047) trying to encrypt connectionStrin

G

Guest

I've been beating my head against the wall trying to do what appears to be
really straight forward. I've been attempting the Walkthrough: Creating and
Exporting an RSA Key Container
(http://msdn2.microsoft.com/en-us/library/2w117ede.aspx). Steps 1-3 work
fine but step 4 fails every time:

1. Create new machine-level RSA key container works just fine
(aspnet_regiis -pc "MyKeys" -exp)

2. Grant Read Access to an RSA Encryption Key works just fine
(aspnet_regiis -pa "MyKeys" "NT AUTHORITY\NETWORK SERVICE")
(aspnet_regiis -pa "MyKeys" "DEVMACHINE\ASPNET")

3. Specify a Protected Configuration Provider works just fine (site runs
fine under IIS, can browse from local and remote IE)
In <configuration> section of web.config:
<connectionStrings>
<add name="SqlServices" connectionString="Data
Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind;" />
</connectionStrings>

<configProtectedData>
<providers>
<add name="MyProvider"
type="System.Configuration.RsaProtectedConfigurationProvider,
System.Configuration, Version=2.0. 0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
processorArchitecture=MSIL"
keyContainerName="MyKeys"
useMachineContainer="true" />
</providers>
</configProtectedData>

4. Encrypt sections of web.config fails every time with message:

Encrypting configuration section...
The given assembly name or codebase was invalid. (Exception from HRESULT:
0x80131047)
Failed!

Every way I try fails the same way
(aspnet_regiis -pe "connectionStrings" -app "/MyWebSite" -prov "MyProvider")
(aspnet_regiis -pef "connectionStrings" "c:\inetpub\wwwroot\MyWebSite" -prov
"MyProvider")

(I'm running XP pro w/SP2, VS 2005, .Net Framework v2.0.50727, IIS 5.1,
windows update is current)

What does this error mean in this situation and how do I go about figuring
out what the problem is?
 
G

Guest

Never mind, I figured it out (and I can't believe more people haven't run
into this and noone's fixed the root of the problem).

Like most Walkthroughs and sample code snippets, I make a habbit of copying
from the web page and pasting into Visual Studio. The problem with this
Walkthrough is that the type property (in the add provider section of
configProtectedData) contains a space character in the part where it shows
"Version=2.0. 0.0," (good thing aspnet_regiis gave a helpful error message!)
Anyway, removing the space ("Version=2.0.0.0,") fixes the problem.
 
Joined
May 17, 2007
Messages
1
Reaction score
0
Aaaaaaaaaahhhhhhhhhhhhhhhhhhhh!!!!

Never mind, I figured it out (and I can't believe more people haven't run
into this and noone's fixed the root of the problem).

Like most Walkthroughs and sample code snippets, I make a habbit of copying
from the web page and pasting into Visual Studio. The problem with this
Walkthrough is that the type property (in the add provider section of
configProtectedData) contains a space character in the part where it shows
"Version=2.0. 0.0," (good thing aspnet_regiis gave a helpful error message!)
Anyway, removing the space ("Version=2.0.0.0,") fixes the problem.

AAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!

I joined this site JUST to say THANK YOU!!!

I have banging my head too on trying to figure this out!!!!

THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! THANK YOU!!!

Literally... All day today, trying to troubleshoot this and figure it out.

@#$%^&* walkthrough tutorials!!!
 
Joined
Jul 2, 2007
Messages
1
Reaction score
0
Else one solution for: "The given assembly name or codebase was invalid"

Hi,

Removing space in "Version=2.0.0.0" did not help in my project case.
After four days internet forums and helps browsing I found that there is else one mistake in "Walkthrough: Creating and Exporting an RSA Key Container":
in "PublicKeyToken=b03f5f7f11d0a3a" there is missing digit "5", must be:
"PublicKeyToken=b03f5f7f11d50a3a"

This mistake is in MS Visual Studio 2005 Express Edition Documentation, but not in MSDN for Visual Studio 2005 current version. Hovewer, if to search for string "b03f5f7f11d0a3a" in this MSDN, you can found mistake in other places also :)

Best regards,
Juozas Kimtys
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top