Question

When installing a .net application on terminal server, this exception is thrown when starting the app :

System.Configuration.ConfigurationErrorsExceptionMessage = Index 1 is out of range.FullText=
 System.Configuration.ConfigurationErrorsException: Index 1 is out of range.
   at System.Configuration.ConfigurationElementCollection.BaseGet(Int32 index)
   at System.Configuration.ConnectionStringSettingsCollection.get_Item(Int32 index)

The connection string, which is in AppName.exe.config, can not be found. However, the config file is placed at the correct location, next to the .exe file, and the connection string is present in the .config file. This error only happens on terminal server, on XP, Vista, win7 everything runs fine ...

Appname.exe.config :

<?xml version="1.0"?>
<configuration>
    <configSections>
        ...
    </configSections>
    <connectionStrings>
        <add name="..."
            connectionString="..." />
        <add name="..."
            connectionString="..." />
    </connectionStrings>
...

What's going on ??

Was it helpful?

Solution

As you probably also found out, the error you get is related to the application not being able to read/write from your xml file.

http://msdn.microsoft.com/en-us/library/system.configuration.configurationerrorsexception(v=vs.80).aspx

I faced a similar issue when running an application in a citrix client and on a terminal server, the app itself ran fine from a client OS and a VHD.

As for troubleshooting this, I would suggest the following..

  • Right click your executable and if you have the option, run it as administrator. If that works then you are certain that you are lacking the correct rights on the location where it is stored with your standard user profile. (even if you have admin rights on your TS, this might still give a difference.)
  • Another option you could test, if it isn't already there, store the application in a location where you have the most access. This will most likely be your userprofile and see if it runs from there.
  • As a third and final option, if possible, have someone with elevated rights on your TS try and run the app.

All of the above steps are related to rights as this was the issue with my app. But ofcourse that is just one way to start troubleshooting it.. hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top