[英]Difference between appSettings and connectionStrings in Web.config file?
[英]Can we encrypt external appSettings and connectionStrings in web.config?
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings configSource="appSettings.config"/>
<connectionStrings configSource="connections.config"/>
<system.web>
<compilation debug="true" />
<authentication mode="Windows"/>
<identity impersonate="true"/>
</system.web>
</configuration>
上面的web.config
用於MVC
Web應用程序。 我試圖使用RsaProtectedConfigurationProvider
和aspnet_regiis進行加密。 但是在簡單的Web.config
, appSettings
和connectionStrings
出現在同一文件中,它無法按預期工作。
我正在使用命令加密web.config
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pef "connectionStrings" "D:\WebApplication" -prov "AppEncryptionProvider".
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pef "appSettings" "D:\WebApplication" -prov "AppEncryptionProvider".
但是在Web應用程序中使用它時,出現以下錯誤:無法使用提供程序'AppEncryptionProvider'進行解密。 提供者的錯誤消息:系統找不到指定的文件。 (來自HRESULT的異常:0x80070002)
Line 1: <appSettings configProtectionProvider="AppEncryptionProvider">
Line 2: <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
Line 3: xmlns="http://www.w3.org/2001/04/xmlenc#">
Line 4: <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
是。 您可以通過提供程序和您的站點名稱使用以下命令來執行此操作。
aspnet_regiis -pe "appSettings" -prov "{0}" -site {1} -app "/"
哪里:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.