Solved

ConfigurationManager.OpenExeConfiguration throws error "Absolute path information is required."

Posted on 2014-12-09
2
393 Views
Last Modified: 2014-12-13
On most servers this code is working fine, but I just bumped into one that is returning this error...

                var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                var section = config.GetSectionGroup("system.serviceModel") as ServiceModelSectionGroup;

Open in new window



Error:
System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Absolute path information is required. ---> System.ArgumentException: Absolute path information is required.
   at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
   at System.Environment.GetFolderPath(SpecialFolder folder)
   at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
   at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
   at System.Configuration.ClientConfigurationHost.get_ConfigPaths()
   at System.Configuration.ClientConfigurationHost.GetStreamName(String configPath)
   at System.Configuration.Internal.DelegatingConfigHost.GetStreamName(String configPath)
   at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()

I don't want to have to make a code change to solve the problem since it is working on all Test Servers and 2 Prod Servers.

The application is a Windows Console App and just referencing the app.config properly named in the same directory with the exe. It works everywhere but on these last 2 servers.

I have found things about using MapPath in StackOverflow, but I don't want to have to make a code change. I'm really looking for information that will guide me to the differences on the servers.

So, my question is, what causes this error to occur on one server and not another? How can I modify my Dev Server to replicate the error so that I can demonstrate the problem to the Sys Admins?
0
Comment
Question by:gswitz
2 Comments
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 40490000
Hard to say without having server access and a better understanding of your setup.
Some guidelines to get you started:
1)  Compare  that all servers have the same OS versions, updates, patches
2) Check user permissions when running the app. (Admin, normal user, etc.)
3) Which location are you running? e.g. Under Program Files folder? If you run the app in say the temp folder ( or any other folder but Program Files folder, Does  it work?
4) If above fails please provide Console app build properties (.net version, x86 or x64 etc.) and server OS/,net version for one working and one affected server.
0
 

Author Closing Comment

by:gswitz
ID: 40498150
This answer was not at all helpful, but I understand that I'm required to give whoever answer the points. The problem is resolved.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
A safe way to clean winsxs folder from your windows server 2008 R2 editions
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question