aspnet_regiis error when encrypting connectionStrings  
Author Message
N8NT





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

I have a website whose domain is www.myWebsite.com and on my server it is located in a directory on my c: drive at the following physical path:

c:\dirVirtual\myWebsite

I have a connection string defined in my web.config in the connectionString section.

<connectionStrings>

<add name="myConnectionString" connectionString="Data Source = 1.2.3.4; Initial Catalog = XYZ; UserID=user;Passowrd=xyz" providername="System.Data.SqlClient" />

</connectionStrings>

I go to the c:\Windows\Microsoft.Net\FrameWork\2.050727 directory and there run the following command to try to encrypt this section:

aspnet_regiis -pe "connectionStrings" -app "/myWebsite" -prov DataProtectionConfigurationProvider

When I do this I get an error

Encrypting configuration section...
A configuration file cannot be created for the requested Configuration object.
Failed!

The -app parameter says it is supposed to be the virtual path but I'm not certain I have that correct. I don't know where to look to see what the virtual name is.

I have been able to successfully encrypt other websites on the same server. Is there any way to find out what the error really is

Thanks,

Bob



.NET Development18  
 
 
N8NT





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

Apparently no one else is having this problem. And, I suppose I know why! It turns out that I needed to go to my physical directory, in this example, c:\dir\virtual\myWebsite, and then right click and open the properties page. From there, select Web Sharing and then click the radio button beside the "Share this folder". I accepted the default properties, but to see what they were I clicked on the "Edit Properties" button. The properties I accepted were Read access permission and scripts application permission. Once I did this, then the aspnet_regiis command worked fine and I got no errors.

I sure wish there were some easy way to have known to do this. I must have read 20 articles on the subject and didn't see one clue about this. That's life... Now I know.


 
 
PeteL - MSFT





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

Hi!

Thanks for asking! I'm a member of the ASP.NET team, and was just popping over here to see what was going on. The best place to ask ASP.NET questions is over on the ASP.NET forums at http://www.asp.net/welcome.aspx tabindex=1&tabid=39

Glad to hear you got your answer! The best place to find out info about this info is on the ASP.NET forums.

HTH,

PEte



 
 
Jigbone





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

Thank you thank you thank you - rescued me - had exactly the same problem, in theory if you have setup a iis virtual application folder (with read and script access), surely the setting in windows explorer should mirror this! How daft is that

Anyway, that solved my problem very quickly and I'd like to thank you for posting your solution - it was a great help for me and I'm sure others with have the same problem and find the solution through the search engines v quickly.

Thanks agian.



 
 
Notes





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

I am also having the problem ... Thank you for the solution!  :)

****EDIT****

I guess I spoke too soon... Doing as suggested did not resolve the problem for me.

Where did you find this information, may I ask..

[...]

Though I have to wonder why a folder that *is* actually shared on the web... Does not reflect that in the "Web Sharing" tab... And so also what is the difference between selecting "Share this folder" in the properties and actually sharing it as a web page/application under IIS !( )

Since we have many IIS servers and the people over in operations are kinda like going... "Why should we turn this on if the web page works for everyone else " (this editor is freaky - it keeps wrapping and un-wrapping the last word of the above paragraph ("under") as I type)

I guess I'll take PeteL's suggestion and go over to the asp.net forum and ask...

Thanks again!   :)

Cheers


 
 
Dave Gelowitz





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

Thanks for reading 20 articles and posting your results, I had the exact same problem, and yours is the first solution I looked at, and it worked! You've saved me a ton of time.

Thanks again,
Dave

 
 
ZAHID HUSSAIN12





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

God Bless you.

when i received message "Succed" i prayed for you from the bottom of my heart.

if the folder in not a root folder still it may not run properly ,may be i am wrong, when i made my solution on the root eg c:\myApp it worked great , it keep on giving me error when it was a subfolder eg : C:\webApps\myApp.

i used both forward / and back slash \

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis -pe "connectionStrin
gs" -app "/jobProj\sqlserver" -prov "DataProtectionConfigurationProvider"
Encrypting configuration section...
A configuration file cannot be created for the requested Configuration object.
Failed!


 
 
Nazzo





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

Thank you, the WebSharing did the trick for me as well!

 
 
Philippe2





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

Hi,

The web sharing solution could work with the “Default Website” but seems not to work with other web sites.

I first found the site ID using the ServerVariables. An easier way is to look in the log files for the website of interest.

Thereafter I used that info in the command: e.g. aspnet_regiis -pe "connectionStrings" -app "/myapp" -site "1219903565"

And I got the error message:

A configuration file cannot be created for the requested Configuration object.

Failed!

Is there a special fix for non-Default Websites

Philippe


 
 
MD11





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

All,



I'm getting a different message when trying to encryot identity section.

I'm using RSA Protected Configuration provider and the aspnet_regiis.exe tool to encrypt section of my web.config file.
I can successfully encrypt 'appSettings' using C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -pe "appSettings" -app "/AppName"
however the similar command when used with 'identity' C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -pe "identity" -app "/AppNAme" gives me the below message ""Encrypting configuration section...
The configuration section 'identity' was not found.
Failed!""

My web.config identity section looks like this...
<identity impersonate="true" userName="domain\userAccount" password="whatever"/>

Trying to encrypt 'sessionState' fails also.



According to MS article 'How To: Encrypt Configuration Sections in ASP.NET 2.0 Using RSA' http://msdn2.microsoft.com/en-us/library/ms998283.aspx, I should be able encrypt <appSettings>, <connectionStrings>, <identity> and <sessionState>. I'd rather encrypt just the sections I need for performance overhead reasons.

Any ideas folks

 
 
Alnilam





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

MD11 You should provide all xml path with system.web prefix:

aspnet_regiis -pe "system.web/identity" -app "/MyWebApp"


 
 
Julius1966





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

Philippe,

i've the same problem...

you've resolved it

command:

aspnet_regiis.exe -pe "connectionStrings" -app "/MyAppWeb" -prov "DataProtectionConfigurationProvider"

error:

A configuration file cannot be created for the requested Configuration object. Failed!

)

bye


 
 
Philippe2





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

Hi,

I am not sure that I am the “Philippe” concerned and I am even not more aware that I had problems with encrypting connection strings. Nevertheless, this is the procedure I use regularly:

  1. To my knowledge, the procedure works only for virtual websites, i.e. in ISS under “Web Sites” I create a new virtual website (I can also create it directly using the publish procedure in visual studio)
  2. In IIS I create an application pool for that website
  3. Be sure that the website uses this application pool : Website – properties – home directory – fields “Application name” AND “ Application pool”
  4. Start the Command Prompt on the computer where the website resides
  5. Change the directory to ... in my case : cd \WINDOWS\Microsoft.NET\Framework\v2.0.50727
  6. Run the following command .... in my case : aspnet_regiis -pe "connectionStrings" -app "/DiddelengVirtual" -site "1219903565"
  7. That’s all
  8. To find the site number (1219903565 in my case) I use the logger of my website (of course logging must be ON) because the log is written in a new directory with directory name W3VC1219903565

Don’t be frustrated but when someone knows the way it’s always difficult to understand that others have difficulties with it.

Have a nice day

Philippe


 
 
Julius1966





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

it's not worked, maybe the problem it's IIS 5 (you're working with IIS 6.0)

Julio Godoy, Chile

 
 
Philippe2





PostPosted: Common Language Runtime, aspnet_regiis error when encrypting connectionStrings Top

Hi,

I amworking on a Windows 2003 R2 Standard SP2 with IIS 6.0

Philippe