C# 哪些信息用于在IIS中加密web.config?

C# 哪些信息用于在IIS中加密web.config?,c#,asp.net,iis,encryption,web-config,C#,Asp.net,Iis,Encryption,Web Config,假设我的web.config中有一个连接部分,如下所示 <connectionStrings> <add name="DefaultConnection" connectionString="Data Source=xxxxxxxx;Initial Catalog=xxxxxx;Persist Security Info=True;User ID=xxxx;Password=xxxx;Enlist=false;MultipleActiveResultSets=True;

假设我的web.config中有一个连接部分,如下所示

<connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=xxxxxxxx;Initial Catalog=xxxxxx;Persist Security Info=True;User ID=xxxx;Password=xxxx;Enlist=false;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
</connectionStrings>

对它进行加密,它就会变成这样

<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
    <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#">
      <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
      <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
        <EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
          <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
          <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
            <KeyName>Rsa Key</KeyName>
          </KeyInfo>
          <CipherData>
            <CipherValue>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</CipherValue>
          </CipherData>
        </EncryptedKey>
      </KeyInfo>
      <CipherData>
        <CipherValue>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</CipherValue>
      </CipherData>
    </EncryptedData>
</connectionStrings>

Rsa密钥
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
到目前为止一切正常

但事情是这样的。我有很多不同的应用程序运行在同一台服务器上,使用完全相同的连接字符串部分。将加密部分复制并通过所有web.configs将非常方便,但当我尝试时,只会产生500个错误

显然,加密数据的某些内容是特定于特定目录的。我知道加密密钥是特定于计算机的,但它们都在同一台服务器上使用相同的密钥,因此我想知道是否有人知道加密的工作原理以及为什么不能从一个子目录复制和粘贴到另一个子目录