asp.net – 使用ASPNet_Regiis加密自定义配置部分 – 你能做到吗
我有一个Web应用程序与自定义配置部分。该部分包含我想加密的信息(希望使用ASPNet_RegIIS,而不是自己做的)。
Web.Config: <?xml version="1.0"?> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <configSections> <section name="MyCustomSection" type="MyNamespace.MyCustomSectionHandler,MyAssembly"/> </configSections> <configProtectedData> <providers> <clear /> <add name="DataProtectionConfigurationProvider" type="System.Configuration.RsaProtectedConfigurationProvider,System.Configuration,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a,processorArchitecture=MSIL" keyContainerName="MyKeyContainer" useMachineContainer="true" /> </providers> </configProtectedData> <MyCustomSection> <blah name="blah1"> <blahChild name="blah1Child1" /> </blah> </MyCustomSection> 配置处理程序在尝试加密之前工作得很好。当我尝试加密它与:
我得到一个错误:
我已经尝试与/没有配置的提供程序。带/不带节组。有/没有手前开始的网站。我试过暂时把我的程序集在GAC中注册。我也试过我的log4net部分只是为了尝试不是我的东西,没有运气。我以管理员身份运行命令提示符。有任何想法吗?或者可以ASPNet_RegIIS只是不是用于自定义部分? 在查看MSDN后的最后一个镜头是改变我的处理程序继承自ConfigurationSection,而不是实现IConfigurationSectionHandler,因为它在技术上已被弃用2.0(希望它是关于aspnet_regiis版本)。也没有运气。 任何想法让我知道。谢谢! 解决方法
aspnet_regiis必须能够绑定程序集。正常的.net绑定规则适用。
我通过在与aspnet_regiis.exe相同的目录中创建名为aspnet_regiis_bin的目录和aspnet_regiis.exe.config文件(aspnet_regiis_bin作为私有路径)来解决此问题: <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatePath="aspnet_regiis_bin"/> </assemblyBinding> </runtime> </configuration> 然后,我将定义自定义配置节的程序集复制到aspnet_regiis_bin中,以便aspnet_regiis可以找到它们。 此过程不需要强制命名或在GAC中的程序集,但确实需要在框架目录中搞乱。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- C#将DataTable转化为List<T>
- asp.net-mvc – 在Asp.Net Core上传图片?
- asp.net-mvc – 根据MVC中第一个dropdownlistfor的值启用第
- 用于XmlHttpRequest的WebAPI的CORS
- ASP.Net Identity 2.0:用户是System.Web.Security.RolePri
- .net – MVC,ViewModels和Validation
- 在ASP.Net应用程序中执行Server.MapPath的最有效的方法是什
- asp.net-mvc-3 – 如何使用Ninject将服务注入MVC?? 3 Filte
- asp.net-mvc-3 – ASP.Net MVC 3 ViewModel数据注释
- asp.net-mvc – ASP.NET MVC Beta支持列表中的Model Binder
- asp.net – visual studio 2017调试无法启动程序
- 无法将Nuget包添加到ASP.NET vNext项目
- asp.net-mvc – 如何减少Azure表存储延迟?
- asp.net-mvc – 在部署MVC 2 Web应用程序时要绝对
- asp.net-web-api2 – 如何在WebAPI中使用Swagger
- asp.net – 如何从数据库中获取null值到gridview
- ASP.net – Crystal Reports导出为PDF会将字母“
- asp.net-mvc – 如何将MVC添加到现有的Web API项
- asp.net-mvc-3 – 以下语句的等效Razor语法?
- ASP.NET:jQuery AJAX’data’param问题