none
Adding APP.config after compilation

    Question

  • Hello folks,

    I have a C# application that has been deployed in production for sometime.  Recently, I have discovered the need for an APP.config file (which was not created for the application when it was first compiled).

    My question is, can I manually create the config file and add it to the root folder where the EXE is running from?

    Thanks.

    Dwight
    Dwight
    Thursday, January 08, 2009 8:14 AM

Answers

  • tfbasta said:

    No, this will not work.  The application has to be coded to expect an app.config and to be able to extract info from it.  As of your previous postings, the application has never been designed to take advantage of the app.config.  Applications do what we program them to do.


    Analyst



    Adding the app.config will work just fine.

    ServicePointManager is pre-programmed in the base class libraries to look at the application configuration file for the value of this property and if it doesn't exist, it will default to true.

    Adding the app.exe.config should work just fine.  Just make sure the users restart their clients.
    David Morton - http://blog.davemorton.net/
    Friday, January 09, 2009 9:52 PM
    Moderator

All replies

  •  How would adding a config file in a already running environment help you? Is the application already implemented by making use of a config file?

    When you really want to add a config file, you can add it, but you should not use "app.config" as name, but "MyApp.exe.config"
    Ewald - Please remember to mark the replies as answers if they help.
    Thursday, January 08, 2009 8:48 AM
  • Hi Ewald,

    The application was compiled without the App.config and then deployed in production several months ago.


    The reason, I want an App.config file now is that I am encountering an HTTP 417 error when making a web service call for some of the clients.

    I have determined that adding the following line of code and re-compiling the app solves the problem.


    System.Net.ServicePointManager.Expect100Continue = false;


    Alternately, I read a post that says adding the following in the app.config file will achieve the same result without requiring any code change in the EXE:

     

    <configuration>

    <system.net>

    <settings>

                <servicePointManager expect100Continue="false" />

    </settings>

    </system.net>

    </configuration>




    I want to manually create the "app.exe.config" file with the above setting and insert it into the root directory for all the client applications. This is easier to do than recompiling the application because the clients have different versions of the app and I don't want to risk any problems in the production environment.

    My question is that if the config file is created in the root directory for a EXE that was not originally using any config file, will the CLR automatically try and use it?


    Thanks
    Dwight
    Thursday, January 08, 2009 9:26 AM
  • No, this will not work.  The application has to be coded to expect an app.config and to be able to extract info from it.  As of your previous postings, the application has never been designed to take advantage of the app.config.  Applications do what we program them to do.
    Analyst
    Friday, January 09, 2009 9:32 PM
  • tfbasta said:

    No, this will not work.  The application has to be coded to expect an app.config and to be able to extract info from it.  As of your previous postings, the application has never been designed to take advantage of the app.config.  Applications do what we program them to do.


    Analyst



    Adding the app.config will work just fine.

    ServicePointManager is pre-programmed in the base class libraries to look at the application configuration file for the value of this property and if it doesn't exist, it will default to true.

    Adding the app.exe.config should work just fine.  Just make sure the users restart their clients.
    David Morton - http://blog.davemorton.net/
    Friday, January 09, 2009 9:52 PM
    Moderator