Solved

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

Posted on 2014-12-09
2
360 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

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now