Solved

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

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
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 walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

733 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