System.Configuration.ConfigurationErrorsException When running from Network Share

31. July 2012 11:29 by Mrojas in   //  Tags: , , , ,   //   Comments (0)

My friend roberto found this error and it seems to be a know .net framework error

If you run the application from a network share you will get an exception like:

System.Configuration.ConfigurationErrorsException: An error occurred creating the configu
ration section handler for overrideConfigurations: Request failed. (R:\Development\Junk\n
ewConsole\TestConsoleApp.exe.Config line 5) ---> System.Security.SecurityException: Reque
st failed.

So the know workarounds listed in that page are: a ZoneMap for he the server/domain name with the network share and give it the Value 0 (Zone 0 = My Computer) did it!There is no GUI dialog to to this (because per default, you cannot change the "My Computer" zone in the internet settings.=>a) Hack the registry to get GUI access to the "My Computer" zone in the Windows internet settings and add the domain with the network share to the "My Computer" zone.b) Directly hack the registry by adding the network share machine name as a key to the Domains key of the ZoneMap (HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\) and give it the DWORD value "file=0".

And the other workaround (which I prefer is):

var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                var junk = config.GetSection("overrides/applicationSettings");