• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 502
  • Last Modified:

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

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
gswitz
Asked:
gswitz
1 Solution
 
Miguel OzSoftware EngineerCommented:
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
 
gswitzAuthor Commented:
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Tackle projects and never again get stuck behind a technical roadblock.
Join Now