Encrypting custom section in web.config give error

Hi,
I want to encrypt custom section in web.config. But I am getting error as “Could not load file or assembly ‘abc.xyz’ or one of its dependencies” while creating release.
In local I am able to encrypt this custom section( for this I want to add my abc.xyz dll in directory where aspnet_regiis is present but in remote I cant do like this)
How can I resolve this error ?

Thanks,
Dipika

Hi Dipika,
Could you provide a little more information about what the project looks like by providing screenshots of deployment steps, and raw logs of these failed tasks. Are you using one of the step templates from our library such as Configuration - Encrypt App.config Section or Configuration - Encrypt Section. Im also not entirely sure what you are referring to by adding the abc.xyz dll in the aspner_regiis directory (is this a custom encryption provider?) or even what you mean when you say you can’t do this “in remote”.
Any extra information you can provide around this issue would help us to get the right picture in our heads about what it is that you are trying to do, and whats going wrong so that we can try and answer your question correctly.
Thanks in advance,
Robert

Hi Robert,
I am using web api project. I am creating its nugget package and deploying it to octopus server. package contains web.config in it. I want to encrypt certain section in web.config including connectionstrings and app settings. encryption doesn’t work for my one of the section which is depend on my helper dll.
Please refer attached log for detail.
Temporary I have added on step where I am commenting
After comment, encryption works fine and after encryption adding one more step to uncomment above line.
But this leads to add2 extra steps. I don’t want to do that. How can I remove given error.

Thanks,
Dipika

ServerTasks-24761.log.txt (18 KB)

Hi Dipika,
Im still not entirely sure what you mean when you say:

Temporary I have added on step where I am commenting
After comment, encryption works fine and after encryption adding one more step to uncomment above line.
But this leads to add2 extra steps. I don’t want to do that. How can I remove given error.

That being said the error message you have provided sounds like its a problem with the the encryption performed by aspnet_regiis than octopus itself. Could you try encrypt these sections manually using aspnet_regiis directly via command line and without Octopus Deploy to focus on the core problem and allow a quicker testing & diagnosis turn around.

It sounds like a common problem whereby the aspnet_regiis process needs to have access to the assembly that defines the configuration section. See aspnet_regiis “Could not load file or assembly ‘SimpleAuthentication.Core’ or one of its dependencies.” – The Blog of Colin Mackay or asp.net - Encrypting custom sections of a web.config - Stack Overflow for an example and how these users got around the problem by adding the dll to the appropriate directory so that it could be accessed by the encryption process. Once the dlls are in the correct location then the encryption should take place successfully with or without Octopus Deploy taking part.
Could you give the above steps a try (and/or clarify the 2nd paragraph in your post regarding extra steps) and let me know how it goes.
Cheers,
Rob

Robert

Yes it is problem with aspnet_regiis. so if I want to encrypt section without octopus then also I have to comment in web.config and then apply command to encrypt section.
Similarly in octopus, I have added step where in web.config I search for “” and replace with "
and then call encryption step. After successful encryption, I uncomment above line.
This is how it works !!
Thanks.

Regards,
Dipika