.NET Configuration Files

Microsoft .NET Framework allows for the specification of configuration files for Windows-, Web- and Internet Explorer-based .NET applications. These configuration files contain settings that affect the .NET runtime environment (e.g., assembly binding and .NET Remoting settings).

When running a .NET test driver with Silk Performer .NET Framework, a configuration file called perfrun.exe.config is created automatically with settings that are required for loading the Silk Performer Framework Assembly and allowing the routing of HTTP traffic over the Silk Performer Web Engine.

You have two options for delivering custom configurations through such configuration files:

Configuration at Runtime

The .NET Class Library provides a class that allows you to configure specific .NET Remoting settings that are loaded from configuration files. If for example you have the following configuration file schema:

<configuration>
<system.runtime.remoting>
<application>
  <channels>
    <channel ref="http" port="2000" />
  </channels>
  <client url="http://remoteserver:2000">
    <activated type="RemoteDll.RemoteClass1, RemoteDll"/>
    <activated type="RemoteDll.RemoteClass2, RemoteDll"/>
  </client>
</application>
</system.runtime.remoting>
</configuration>

…and you store this in a file in your project directory and add it to your data file section you can use the following code to load it at runtime (most likely in the method that corresponds to your init transaction):

RemotingConfiguration.Configure(Bdl.GetDataFilePath("vuser.config"));

Other settings that can be configured in the application configuration file can be changed through other classes of the .NET Framework, for example, System.AppDomain. For a detailed description of the classes that allow for modification of the .NET Runtime Environment, see the MSDN Online Reference.

Own Configuration File

When running a test using the Silk Performer .NET Framework, Silk Performer automatically generates a configuration file that is used to initialize the .NET runtime that is hosted in the virtual user process. This file is called perfrun.exe.config and is stored to the Silk Performer installation directory. The file has a schema like the following:

<configuration>
<system.net>
...
</system.net>
<runtime>
...
</runtime>
</configuration>

When generating this configuration file, Silk Performer looks for an app.config file in your project directory. If there is such a file, the content of the file is merged just after the runtime node. This means that you can define any required configuration XML elements in your app.config file. But you must ensure that the file doesn't have the root configuration tag or one of the tags generated by Silk Performer (system.net or runtime).

Here is a sample configuration file for .NET Remoting components:

<system.runtime.remoting>
<application>
<channels>
  <channel ref="http" port="2000" />
</channels>
<client url="http://remoteserver:2000">
  <activated type="RemoteDll.RemoteClass1, RemoteDll"/>
  <activated type="RemoteDll.RemoteClass2, RemoteDll"/>
</client>
</application>
</system.runtime.remoting>