首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在IIS8上发布后,web配置中的连接字符串的ASPNET_REGIIS加密不起作用

在IIS8上发布后,web配置中的连接字符串的ASPNET_REGIIS加密不起作用
EN

Stack Overflow用户
提问于 2018-12-13 05:26:47
回答 1查看 355关注 0票数 0

我使用ASPNET_REGIIS技术对web配置中的连接字符串进行了加密。当我在本地运行我的web Api时,它工作得很好。当我将它发布到IIS8时,我得到了500个内部服务器错误。我正在使用实体框架进行数据库连接。以下是我在服务器上加密后的web配置。请帮帮忙

代码语言:javascript
复制
    <?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=301879
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings></appSettings>
  <system.web>
    <compilation targetFramework="4.6.1" />
    <httpRuntime targetFramework="4.6.1" />
  </system.web>
  <system.webServer>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.4.0" newVersion="5.2.4.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>
  <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>b5kY1n7Zp1P1FEEDi5nYlM0rdtU6gtpKm0AfudUqsCeF7Hzc6Q93SbXlwX06tfVMWK/HntfqJ28Y6DgRJth/PIewupMsETLF/tnHHyuHWuHetiup1P5e0q24WyqlrsaNWD6NYzl+XYW6C6lNuun3UXkp+B6UJPl+553tUq5TKeQ=</CipherValue>
          </CipherData>
        </EncryptedKey>
      </KeyInfo>
      <CipherData>
        <CipherValue>QhdAFCWmfEVRrsQrfwpFDgWyLQa2Oymicsf5Hp3BDgELJUjAeUOfBzSp2x20gEClqPNkBXQhkCgJht5ZmzqavxHjDTVVClzPQRNjcI6Rec1D6NDwkfCbY2zPU7150cX9AC0J48bwblOc7DuxSR6+A97D0SSWmFaexYMQZxsfq4fMcRGTKUrKL83bXELP0rUo14U22J1dpnRwQiS2Lu0ctR1OjvLVD+YKt3R7mpkPHJPOcikOeL65P4dy2UZwj8EBWzgSrEDLvYqVk5H7BGP4KxpL+mX4krUTQqlDmriUZ4Q3+YmpfVHVAsx9XcudA6PaFjlFTfkBL5RTKMv/EYeITLApfIRnPSWla38NGqC5pMV76df7DQXWoSb+22vTjyCAvQlpApDwKR0tATdDJagwZcXSeE/82VHYOqyFVSY9gZkTsauXSYOW4eQPb1yhgp1jwWAVmKNU6qCgKbJUCE8FlxOUrQ1AjOsLBZthzogaTZQRLdnzX1vBRl0vv+E6uvBAwujHGeC9Dh6skbckVD8vAqG6hRXvBV0y17egjmAS0miLKpHzt0TV74UD1aRiqEt/zRRhYPMBCMs1NJ2vtMpDk1stJqnAfj8IEhAQ+GAFLxhV9eXvXg8zE3s309mG738btGircXn9ErgdABi8qF/YU4U7yklA/xF6STVN8wlij2AUO+k38L9H1/AFgAOYSBh6RQkEIXFlhhrIMtiJQOUIpmKrs4qrIzVWnp9Usz3bnNoO3XkwclzATZv+9OSHg3uLnRUbhire61o9l3hDJzD+MijZ3dD28g579BCymzF3XFO/92Y7gWaXn/nOAzplluUj0gsGvNlAebephxS0PovMENGtGCLsWI5qRR0qri46AiEq3i549LN/PaLH9cU/LL0uAXI5UXjrqZbPPmCo4eIYbkHp3vPE/BJHXfD4sPqIoxeuqJ4MYLWcJ6Z7i++n5tXj2svLaPU8GlV8/9tkYtevRs1a3KsMNu2Owmz7dLEUrXGsB3zxIj7Al7aaWfTKA8um+NAfzlZMuQjADv4XZX1RIn120Fp5PEpueK409ej2YI75B9Ob6Btu4srsM55QzkRwOldSeJToS8Z5P2/22FXu75TnKM+olLJCu/SeyxmE1vxntSkpGlFRxCQOvMTdjndLJM3pStY8jtY=</CipherValue>
      </CipherData>
    </EncryptedData>
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>
<!--ProjectGuid: 866D7495-35B3-4EE8-9806-8A547E5AA3D2-->
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-12-13 06:28:58

在没有更多细节的情况下,我的第一个想法是密钥尚未导入到目标服务器。你也许能够找到关于这个StackOverflow问题的更多细节:Deploying Pre-Encrypted Configuration Files to a Production Environment

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53751614

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档