开发者

Can I encrypt web.config with a custom protection provider who's assembly is not in the GAC?

开发者 https://www.devze.com 2022-12-30 19:12 出处:网络
I have written a custom protected configuration provider for my web.config. When I try to encrypt my web.config with it I get the following error from aspnet_iisreg

I have written a custom protected configuration provider for my web.config.

When I try to encrypt my web.config with it I get the following error from aspnet_iisreg

aspnet_regiis.exe -pef appSettings . -prov CustomProvider (This is running in my MSBuild)

Could not load file or assembly 'MyCustomProviderNamespace' or one of its dependencies. The system cannot find the file specified.

After checking with the Fusion log, I confirm it is checking both the GAC, and 'C:/WINNT/Microsoft.NET/Framework/v2.0.50727/' (the location of aspnet_iisreg). But it cannot find the provider.

I do not want to move my component into the GAC, I want to leave the custom assembly in my ApplicationBase to copy around to various servers without having to pull/push from the GAC.

Here is my provider configuration in the web.config.

<configProtectedData>
  <providers>
    <add name="CustomProvider"
        开发者_StackOverflow type="MyCustomProviderNamespace.MyCustomProviderClass,
         MyCustomProviderNamespace" />
  </providers>
</configProtectedData>

I want aspnet_iisreg to check my ApplicationBase Bin folder for this assembly. Has anyone got any ideas?


Bit dirty, what I ended up doing was adding the DLL doing the encryption to the GAC of the build machine. This encrypted the config okay.

When deploying the solution, I copied the Dll into the ApplicationBase, the application was able to decrypt it succesfully.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号