Solved

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

Posted on 2014-12-09
2
424 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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 steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

726 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