我必須加密我的web.config與section.sectioninformation.protectsection()和相同的web.config將運行3個服務器。加密web.config與protectsection()爲獨立的機器
是否有任何可能的方法來完成此任務。
我必須加密我的web.config與section.sectioninformation.protectsection()和相同的web.config將運行3個服務器。加密web.config與protectsection()爲獨立的機器
是否有任何可能的方法來完成此任務。
看看這篇文章:https://msdn.microsoft.com/en-us/library/ms998283.aspx
命令:
aspnet_regiis.exe -pef "connectionStrings" C:\Projects\MachineRSA
來源:
https://stackoverflow.com/a/976117/3850405 https://stackoverflow.com/a/5717845/3850405 How to encrypt web.config section AND deploy to multiple servers with Amazon Elastic Beanstalk
我從來沒有這樣做過編程,但使用aspnet_regiis.exe,將以下部分添加到web.config文件中。注:確保類型信息是正確的 - 查看machine.config。
<configProtectedData defaultProvider="myRsaProvider">
<providers>
<add name="myRsaProvider"
type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
keyContainerName="myRsaKeys"
useMachineContainer="true" />
</providers>
</configProtectedData>
在c。創建一個可導出機器級RSA密鑰容器
aspnet_regiis -pc "myRsaKeys"–exp
授予權限密鑰容器
aspnet_regiis -pa "myRsaKeys" "yourDomain\yourUsername"
加密的appSettings web.config中的部分:\ TEMP \使用定製RsaProtectedConfigurationProvider,myRsaProvider
aspnet_regiis -pef "appSettings" c:\temp\ -prov "myRsaProvider"
導出RSA密鑰容器
aspnet_regiis -px "myRsaKeys" myRsaKeys.xml -pri
導入您安裝web.config中的任何機器上的RSA密鑰容器。
aspnet_regiis -pi "myRsaKeys" myRsaKeys.xml
按照以下鏈接: https://www.codeproject.com/Tips/877258/How-to-Encrypt-Web-config-Using-aspnet-regiis-exe 您將不得不使用** aspnet_regiis.exe ** 。例如 'aspnet_regiis.exe -pef'命令(加密) 該命令對特定硬盤驅動器位置中的特定部分進行加密,以便例如對位於「C:\ inetpub \ wwwroot \ app」的站點中的「appSettings」部分進行加密\ WebConfigEncryption「運行: 'aspnet_regiis.exe -pef appSettings C:\ inetpub \ wwwroot \ app \ WebConfigEncryption' – Nirzar