加密Web.Config外部文件中的AppSettings [英] Encrypting AppSettings in file external to Web.Config

查看:89
本文介绍了加密Web.Config外部文件中的AppSettings的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用此方法对应用程序的web.config文件的AppSettings部分进行加密: aspnet_regiis.exe -pe"appSettings"-站点"MySite" -app"/"

I currently use this method to encrypt the AppSettings section of my application's web.config file: aspnet_regiis.exe -pe "appSettings" -site "MySite" -app "/"

但是现在我已经使用元素

But now I have moved some settings out to another file using the element

<appSettings file="IndividualAppSettings.config" >

我仍然可以在web.config中对应用程序设置进行加密,但是有什么方法可以对附加的IndividualAppSettings.config文件的内容进行加密?

I can still encrypt the app setting in the web.config, but is there any way to encrypt the content of the additional IndividualAppSettings.config file?

推荐答案

我们一直在执行此操作,因为我们在每个环境中都使用外部文件.

We do this all the time as we use external files for each of our environments.

首先,您的 appSettings 元素需要看起来像这样:

First your appSettings element needs to look like this:

<appSettings configSource="IndividualAppSettings.config" />

接下来,我们使用以下命令从cmdline调用加密:

Next, we call the encryption from the cmdline using:

aspnet_regiis -pe "appSettings" -prov "{0}" -site {1} -app "/"

其中:

  • {0} 是在web.config中指定的加密提供程序的名称.
  • {1} 是您的站点在IIS中的ID
  • {0} is the name of your encryption provider specified in the web.config.
  • {1} is the Id of your site in IIS

这篇关于加密Web.Config外部文件中的AppSettings的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆