|The exception is thrown by the CLR when you don't have the specified permission. In this case, the requested permissions is a
StrongNameIdentityPermissions. Reading the machine.config is a protected operation (it contains machine-sensitive information) so you're assembly has to be signed (and honestly, it should anyway).
To sign your assembly, generate a key pair (public and private keys) using "sn.exe -k KeyFile.snk" and put it somewhere safe. You should actually try to use this for all your code, but do not distribute it to anyone but - if applicable - your development team (unless you use late-signing and have a build master). Make sure you have an assembly-level
AssemblyVersionAttribute and either an
AssemblyKeyNameAttribute. If you created your project with VS.NET, you will find these in your AssemblyInfo.cs file (but the can be placed anywhere so long as they're prefixed with
[assembly: ...]). This creates a strong-named assembly.
Read the documentation about the
AssemblyKey* attributes toward the bottom of the file. It's also recommended in multi-project solutions that you do not use a automatically-generated version number because things can easily get out of hand.
-----BEGIN GEEK CODE BLOCK-----
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----