4

Based off of this page, I did the following:

  1. Went to "All Programs" -> "Microsoft Visual Studio 2012" -> "Visual Studio Tools" -> "Open VS2012 x64 Native Tools Command Prompt".
  2. Typed: aspnet_regiis -pe "connectionStrings" -app "C:/FirstName-Projects/ProjName-TEST/SolutionName/Web.config" -prov "DataProtectionConfigurationProvider"
  3. Received: "The value used in the -app parameter must begin with a forward slash."

I'm guessing I did something wrong in my attempt to call the Web.config file down through my C: directory?

I then read through to the part of Step 3.4 and also tried the -pef by using aspnet_regiis -pef "connectionStrings" C:FirstName-Projects/ProjName-TEST prov "DataProtectionConfigurationProvider" which resulted in a full listing of all registration options I can provide.

Can anyone provide me some input on what to use based on the Web.config file being in C:/FirstName-Projects/ProjName-TEST/SolutionName/Web.config?

Analytic Lunatic
  • 3,853
  • 22
  • 78
  • 120

2 Answers2

7

Please use the below syntax for encrypting the physical file.

aspnet_regiis -pef "connectionStrings" "C:/FirstName-Projects/ProjName-TEST/SolutionName"

Ensure you run the command editor as administrator

Note: The app means the IIS virtual path in command you mentioned

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Prem Sriram
  • 190
  • 5
  • Interesting. This resulted in "The parameter 'PhysicalDirectory' is invalid." Parameter Name: PhysicalDirectory, Failed! Thoughts? – Analytic Lunatic Nov 01 '13 at 16:55
  • Can you please try it with D drive or something? I tested on the below drive "d:\temp\solution". also please change slash in the path. – Prem Sriram Nov 01 '13 at 17:17
  • Here is the command i tested in my machine: aspnet_regiis -pef "connectionStrings" "D:\Projects\jsontest" – Prem Sriram Nov 01 '13 at 17:26
  • 1
    Getting closer. Changed "/" to "\" in the path and received: "An error occurred loading a configuration file: Unable to open file 'C:\FirstName-Projects\ProjName-TEST\SolutionName\web.config' for writing because it is read-only or hidden. Failed!" – Analytic Lunatic Nov 01 '13 at 18:05
  • You shouldn't specify the web.config in the path. It should be only till the directory. Please check my example: aspnet_regiis -pef "connectionStrings" "D:\Projects\jsontest" – Prem Sriram Nov 01 '13 at 18:13
  • I didn't specify the config file, I only specified to the directory. The error message above included the web.config listed in it's message. My input: aspnet_regiis -pef "connectionStrings" "C:\FirstName-Projects\ProjName-TEST\SolutionName" |Nothing else. – Analytic Lunatic Nov 01 '13 at 18:17
  • 1
    Okay got it, can you use the "run as administrator" on the VS command prompt? Otherwise move the solution to Drive, now it seems to be permission issue. – Prem Sriram Nov 01 '13 at 18:19
  • How do I do the "run as administrator" on the VS command prompt? – Analytic Lunatic Nov 01 '13 at 18:23
  • Nevermind, I got it! Went into the properties of the file and unchecked "Read-only". Everything is debugging correctly and appears to be encrypted and working now :) thanks for all the help! – Analytic Lunatic Nov 01 '13 at 18:57
0

Few things to keep in mind.

  1. Do not mention the name of configuration file in the path. If you mention the full path, it returns "configuration for physical path cannot be opened"
  2. If the path ends with a blank space, it throws "the parameter 'physicaldirectory' is invalid" error.
  3. Make sure you get rid of a back slash at the end of the path. If you have a back slash, it complains about illegal characters.

In my case, the path ended with a blank space. After removing the blank space, the error disappeared.

MKK
  • 11
  • 1
  • 4