Unrecognized configuration section” after adding Signature to Config File using SignedXml.ComputeSignature?

You are missing some essential information to allow signutures to be embedded in the app.config.

Up vote 2 down vote favorite 1 share g+ share fb share tw.

I have a Windows Forms application built using the . NET 3.5 Framework which self hosts a WCF service. The service & app function properly on their own.

Concerned about having the address & binding info accessible in the app. Config file, I decided to add a digital signature using System.Security.Cryptography.Xml.SignedXml. ComputeSignature.

I then added the signature to the the app. Config and saved it. This creates a Signature element in the app.

Config as the final child of the configuration node of the app. Config file. I added a function to check the signature before starting the service.

The app properly verifies the signature, but then when trying to start the service, it throws the following nested errors: The type initializer for 'System.ServiceModel. DiagnosticUtility' threw an exception. 2.

Configuration system failed to initialize 3. Unrecognized configuration section Signature. It doesn't seem to matter where I place the Signature element in app.config.

The signature always verifies properly, and the service always bombs griping about the unrecognized configuration section. Commenting out the Signature element in the app. Config and the signature check in the code, the service will start again with no issues.

Why does the service throw these errors, and what can I do to resolve them? Here is the app. Config with redacted application names & urls: M 1111 120000 jJYnz3j6LgxqdcUgvNSGNmJVum4= czpn/uA31kMSoGFk2hi3SCYky6YM6/MjBT3lpMn7wluCjeFIFj0vJJZVI9ueQQn/RglFi8RIfAyov3rDwiS+pP/4b1Yh8KqNOftHMH9pC+CFsMHMQnIoPHyXVrFLpuU6rzjACdUky4zuB7I7Q5AHf1CF8F9PSEgIxiQ4gHgPhJCLujl6wvsMg3rXDHazRQ2Curj94iKUIsKo50X1dJxER1oWOB9g6QgzqsXTOmUkgGOygJrnrn1WQJ0UbWAvHHXIPZdD6jOL24vqhOYm55+b6hlkWdIvEvLBPVMtv2V8oQqxBpWRDh8ovMn4LQdgcFOpa/vG3ISXGp2oRzsCEpaxCQ== .net configuration app-config xml-signature link|improve this question edited Oct 1 '11 at 22:21John Saunders86.8k763144 asked Oct 1 '11 at 2:13Heather B305.

BTW, your service didn't throw these errors. The . NET configuration system threw an exception because your configuration file had an unknown section in it.

– John Saunders Oct 1 '11 at 22:23 John - thanks for clarifying. Since the error was being thrown when the service attempted to start, I just associated the two, but it didn't make sense to me that the service itself would be the root cause. – Heather B Oct 2 '11 at 2:19.

You are missing some essential information to allow signutures to be embedded in the app.config. From beefycode.com/post/Managing-AppConfig-In... about adding Signatures to app. Config files: We can't just plop this new element in the app.

Config and expect the . NET configuration manager to process it without knowing what it is; this will cause failure during application startup. No special tricks here, we simply need to instruct the configuration system to ignore this element by adding the following to the top of the config file.

Start by entering the following in the app. Config: ... View the above link for full app. Config and usage example.

It should do the job.

Thanks - this is exactly what I needed. Thought there might be something I could add to the configSections, but didn't know what to search for. Just tested the change out and it worked like a champ.

You made my weekend! :) – Heather B Oct 2 '11 at 2:18.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions