Windward Ohana.NET Report Engine User Manual Reference.NET Report Engine Configuration File Reference

.NET Report Engine Configuration File Reference

The article details how to name the .NET Engine configuration file, and its contents.

app.exe.config

In the .NET environment, we are encouraged by Microsoft to use a configuration file rather than the Windows Registry for settings and values. The advantage to this is you can use config files to copy all files to a new location without requiring the migration of a bunch of different settings and values in the Registry.

The name and location of these files is set by Microsoft and cannot be overridden (it is different for Office Add-Ins such as Report Designer). The schema for the config (XML) file is also specified by Microsoft.

For an ASP.NET application, the config file is named ‘web.config’ and goes in the root directory of the website.

For a program named "RunReport.exe" the file is labeled "RunReport.exe.config". This must be in the same directory as RunReport.exe. If you rename "RunReport.exe" to "MyCoolApp.exe", then you need to also rename the config file "MyCoolApp.exe.config". The common shorthand for the config file is "app.exe.config", but that is not its actual name (unless your application is named "app.exe", which is unlikely).

Sample app.exe.config File

We provide a sample config file named ‘WindwardReports.dll.config’ with .NET Report Engine, but a config file with that name is not used by .NET Report Engine. Please do not try to use a file with this name.

Below is a sample config file with the minimum required settings for .NET Report Engine. At a minimum, your license key must go in this file. .NET Report Engine will not look in the registry for the license key; it must be in the config file. Generally (definitely in the case of an ASP.NET app), you will have additional sections in this file.

Although not required, we've included a logging section in the sample app.exe.config, since logging is used so often by embedding-application developers and Support for troubleshooting.

<?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <configSections>
            <section name="WindwardReports" type="System.Configuration.NameValueSectionHandler"/>
        </configSections>  
    <WindwardReports>
    <!-- Put your key here. Multiple lines are ok but do not put spaces at the beginning/end of the lines -->
        <add key="license" value="the/license/goes/here"/>
    </WindwardReports>
    
    <log4net>
        <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
            <param name="File" value="RunReport.log" />
            <param name="AppendToFile" value="true" />
            <param name="MaxSizeRollBackups" value="2" />
            <param name="MaximumFileSize" value="100KB" />
            <param name="RollingStyle" value="Size" />
            <param name="StaticLogFileName" value="true" />
            <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] ac.server %-5p %c - %m%n" />
            </layout>
        </appender>
        <root>
            <level value="INFO" />
            <appender-ref ref="RollingFileAppender" />
        </root>
    </log4net>
</configuration>

Log File Not Created?

Having problems with your log file not being created? To address that:

If you configured logging in your app.exe.config file and you find that there is no log file created, make sure you have permissions to write to the location you specified in app.exe.config.

If that doesn't resolve the issue, try putting the following code in your application before your logging code: log4net.Config.XmlConfigurator.Configure();

You can define it in Global.asax:

void Application_Start(object sender, EventArgs e)
{
    // Code that runs on application startup
    // Initialize log4net.
    log4net.Config.XmlConfigurator.Configure();
}

You can also add the following line (either mentioning your config file name or not):

[assembly: log4net.Config.XmlConfigurator]

 Or

 [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Web.config", Watch = true)]

Optional Settings

See .NET Report Engine app.exe.config Settings for all of the optional settings that can be added to app.exe.config.

0 Comments

Add your comment

E-Mail me when someone replies to this comment