Config File

This page documents the sections that must be added to the application config file to be able to be able to use the XrmLibrary and log4net.

Below is a sample config file with all required sections. The CrmServiceConfigurations element supports any number of configurations for integration support when working with multiple instances of Microsoft Dynamics CRM 2011. This config file is setup to roll log files after they reach 100KB in size and will create a new log file every day for ease of archiving. More configurations can be found by viewing the documentation at http://logging.apache.org/log4net/release/features.html.

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="log4net" type="System.Configuration.IgnoreSectionHandler"/>
    <section name="XrmLibrary" type="XrmLibrary.Connections.XrmLibraryConfigSection, XrmLibrary"/>
  </configSections>

  <!-- This section contains the XrmLibrary configuration settings. -->
  <XrmLibrary>
    <CrmServiceConfigurations>
      <!-- Format: <add CrmOrganizationUrl="<OrganizationServiceUrl>" DiscoveryServiceUrl="<DiscoveryServiceUrl>(Optional)" CrmAuthenticationType="<AD/IFD/Passport>" CrmUserName="********" CrmPassword="********" /> -->
      <add CrmOrganizationUrl="https://<CrmServerUrl0>/XRMServices/2011/Organization.svc" CrmAuthenticationType="AD" CrmUserName="********" CrmPassword="********" />
      <add CrmOrganizationUrl="https://<CrmServerUrl1>/XRMServices/2011/Organization.svc" CrmAuthenticationType="IFD" CrmUserName="********" CrmPassword="********" />
      <add CrmOrganizationUrl="https://<CrmServerUrl2>/XRMServices/2011/Organization.svc" CrmDiscoveryUrl="https://<DiscoveryServerUrl2>/XRMServices/2011/Discovery.svc" CrmAuthenticationType="Passport" CrmUserName="********" CrmPassword="********" />
    </CrmServiceConfigurations>
  </XrmLibrary>

  <!-- This section contains the log4net configuration settings -->
  <log4net>
    <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
      <file value="log.txt"/>
      <appendToFile value="true"/>
      <layout type="log4net.Layout.PatternLayout">
        <header value="[Header]"/>
        <footer value="[Footer]"/>
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline%exception"/>
      </layout>
    </appender>
    <!-- Setup the root category, add the appenders and set the default level -->
    <root>
      <level value="INFO"/>
      <appender-ref ref="LogFileAppender"/>
    </root>
  </log4net>
</configuration>

Last edited Oct 26, 2011 at 9:10 PM by cchamberlain, version 4

Comments

airrick2 Feb 24, 2013 at 4:15 PM 
for the source that was checked in on Dec 20, 2012 this is what the config should look like (NOTE: camel case not title case);

<configSections>
<section name="xrmLibrary" type="XrmLibrary.ConfigFile.XrmLibraryConfigSection, XrmLibrary" />
</configSections>

<!-- This section contains the XrmLibrary configuration settings. -->
<xrmLibrary>
<crmServiceConfigurations>
<add name="crm2011Instance" crmOrganizationUrl="https://YOURORGNAMEHERE.crm.dynamics.com/XRMServices/2011/Organization.svc" crmAuthenticationType="Passport" crmUserName="***************" crmPassword="************" />
</crmServiceConfigurations>
</xrmLibrary>