aspnet_regiis fails (0x80131047) trying to encrypt connectionStrin

Discussion in 'ASP .Net' started by =?Utf-8?B?TWFyYyBCLg==?=, Jul 26, 2006.

  1. 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?
     
    =?Utf-8?B?TWFyYyBCLg==?=, Jul 26, 2006
    #1
    1. Advertising

  2. 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.

    "Marc B." wrote:

    > 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?
    >
    >
     
    =?Utf-8?B?TWFyYyBCLg==?=, Jul 27, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?TWFyYyBCLg==?=

    donato1026

    Joined:
    May 17, 2007
    Messages:
    1
    Aaaaaaaaaahhhhhhhhhhhhhhhhhhhh!!!!

    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!!!
     
    donato1026, May 17, 2007
    #3
  4. =?Utf-8?B?TWFyYyBCLg==?=

    Juozas_K

    Joined:
    Jul 2, 2007
    Messages:
    1
    Location:
    Lithuania, Vilnius
    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
    :)
     
    Juozas_K, Jul 2, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sergey V. Alimov
    Replies:
    2
    Views:
    2,749
    Sergey V. Alimov
    May 17, 2005
  2. =?Utf-8?B?RGF2aWQ=?=

    aspnet_regiis -pa fails to locate container

    =?Utf-8?B?RGF2aWQ=?=, Sep 5, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    3,372
    =?Utf-8?B?RGF2aWQ=?=
    Sep 5, 2006
  3. rockdale
    Replies:
    2
    Views:
    536
    Mohamad Elarabi
    Dec 20, 2007
  4. anbaesivam
    Replies:
    9
    Views:
    4,882
    Allen Chen [MSFT]
    Mar 26, 2009
  5. http://ejobseek.com

    Encrypt in Perl, De-encrypt in Javascript

    http://ejobseek.com, Sep 1, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    290
    James Willmore
    Sep 1, 2003
Loading...

Share This Page