Unable to use aspnet_regiis encrypt web.config in windows 7/2008 environment
I used aspnet_regiis successfully encrypted web.config file which running on windows 2003 server. However it doesn't work in IIS 7 on Windows 7/开发者_如何转开发2008 server.
When I try to run the followng command in 64bit Windows 2008 server, it always shows the aspnet_regiis options help. The same thing is in windows 7 OS.
C:\Windows\Microsoft.Net\Framework64\v2.0.50727\aspnet_regiis –pe “appSettings” –app “/ConnectionTest” –site 4
If I open Visual Studio 2008 command in windows 7 and run the following command, I got those. I use the site Id from iis manager.
aspnet_regiis –pe “appSettings” –app “/ConnectionTest” –site 4 Failed to resolve the site ID for '4' Failed!
Have you tried running a command window "As Administrator"? This just caught me out for a moment too but running as admin fixed it.
I was getting this error even after running command prompt as an administrator. But I observed that the virtual directory in my case had multiple words separated by dot. Like "Web.Api.XYZApi".
I changed the virtual directory name to "XYZApi" (without the dots) and tried encrypting and it worked. But I'm still not sure why that should be an issue.
精彩评论