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.
 

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

Similar Threads


Top