Jump to: navigation, search

Difference between revisions of "Configuration File Example"


(system.serviceModel)
(Redirected page to Configuration Files)
 
(68 intermediate revisions by 3 users not shown)
Line 1: Line 1:
===configSections===
+
#REDIRECT [[Configuration_Files]]
 
+
In the configSection Tag service specific configuration sections can be defined. These settings include logging and exception handling in the ubik web service. This tag should not be changed generally.
+
<syntaxhighlight lang="xml">
+
  <configSections>
+
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
+
    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
+
  </configSections>
+
</syntaxhighlight>
+
 
+
===loggingConfiguration===
+
 
+
Here the logging of the web service is configured for different types of information (errors, warnings, ...). It is important to specify a path where the system user executing the web service has all the needed access rights.
+
<syntaxhighlight lang="xml">
+
  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="ASSERTION">
+
    <listeners>
+
      <add name="log.warning" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        fileName="C:\UBIK_Logs\.UBIK.LOG.BUILD\warnings.log" footer="" formatter="Text Formatter SMALL"
+
        header="-----------------------------------------------------------------"
+
        rollFileExistsBehavior="Increment" rollInterval="None" traceOutputOptions="None" />
+
      <add name="log.error" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        fileName="C:\UBIK_Logs\.UBIK.LOG.BUILD\error.log" footer="" formatter="Text FormatterFULL"
+
        header="-----------------------------------------------------------------"
+
        rollFileExistsBehavior="Increment" rollInterval="Week" />
+
      <add name="log.assertion" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        fileName="C:\UBIK_Logs\.UBIK.LOG.BUILD\assertion.log" footer="" formatter="Text Formatter ASSERTION"
+
        header="-----------------------------------------------------------------"
+
        rollFileExistsBehavior="Increment" />
+
      <add name="log.debug" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        fileName="C:\UBIK_Logs\.UBIK.LOG.BUILD\debug.log" footer=""
+
        formatter="Text Formatter SMALL" header="----------------------------------------"
+
        rollFileExistsBehavior="Increment" />
+
      <add name="log.error.header" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        fileName="C:\UBIK_Logs\.UBIK.LOG.BUILD\debug.error.header.log" footer="" formatter="Text Formatter TINY"
+
        header="-------------------------------------" rollFileExistsBehavior="Increment" />
+
      <add name="servicelog" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        fileName="C:\UBIK_Logs\SericeLogs\Infopath.V2\infopath_service_v2.log"
+
        footer="" formatter="Text Formatter.SERVICE" />
+
      <add name="servicelog.rolling" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        fileName="C:\UBIK_Logs\.UBIK.LOG.BUILD\service.build.V2.log"
+
        footer="" formatter="Text Formatter.SERVICE" header="########################################"
+
        rollFileExistsBehavior="Increment" rollSizeKB="1000" maxArchivedFiles="50" />
+
    </listeners>
+
    <formatters>
+
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
+
        name="Text FormatterFULL" />
+
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        template="{timestamp}{newline}&#xA;{category} [{eventid}]{newline}&#xA;{processName}{newline}&#xA;{message}{newline}"
+
        name="Text Formatter ASSERTION" />
+
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        template="{timestamp}{newline}&#xA;{category} [{eventid}]&#xA;{processName}{newline}&#xA;{message}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
+
        name="Text Formatter SMALL" />
+
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        template="{timestamp}  {message}{newline}" name="Text Formatter TINY" />
+
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
        template="{timestamp}{newline}&#xA;{processName}{newline}&#xA;{newline}&#xA;Parameter: {newline}&#xA;----------------{newline}&#xA;{dictionary({key} - {value}{newline})}&#xA;{newline}&#xA;Result:{newline}&#xA;----------------{newline}&#xA;{message}{newline}&#xA;&#xA;"
+
        name="Text Formatter.SERVICE" />
+
    </formatters>
+
    <categorySources>
+
      <add switchValue="All" name="ASSERTION">
+
        <listeners>
+
          <add name="log.assertion" />
+
        </listeners>
+
      </add>
+
      <add switchValue="All" name="WARNING">
+
        <listeners>
+
          <add name="log.warning" />
+
        </listeners>
+
      </add>
+
      <add switchValue="All" name="ERROR">
+
        <listeners>
+
          <add name="log.error.header" />
+
        </listeners>
+
      </add>
+
      <add switchValue="All" name="DEBUG">
+
        <listeners>
+
          <add name="log.debug" />
+
        </listeners>
+
      </add>
+
      <add switchValue="All" name="EXCEPTION">
+
        <listeners>
+
          <add name="log.error" />
+
        </listeners>
+
      </add>
+
      <add switchValue="All" name="SERVICE">
+
        <listeners>
+
          <add name="servicelog.rolling" />
+
        </listeners>
+
      </add>
+
    </categorySources>
+
    <specialSources>
+
      <allEvents switchValue="All" name="All Events" />
+
      <notProcessed switchValue="All" name="Unprocessed Category" />
+
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
+
        <listeners>
+
          <add name="log.error" />
+
        </listeners>
+
      </errors>
+
    </specialSources>
+
  </loggingConfiguration>
+
</syntaxhighlight>
+
 
+
===exceptionHandling===
+
 
+
In this tag the settings for exception handling can be specified.
+
 
+
<syntaxhighlight lang="xml">
+
  <exceptionHandling>
+
    <exceptionPolicies>
+
      <add name="System.Exception">
+
        <exceptionTypes>
+
          <add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+
            postHandlingAction="None">
+
            <exceptionHandlers>
+
              <add name="System.Exception" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
                logCategory="EXCEPTION" eventId="100" severity="Error" title="System.Exception"
+
                formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
                priority="0" />
+
            </exceptionHandlers>
+
          </add>
+
        </exceptionTypes>
+
      </add>
+
    </exceptionPolicies>
+
  </exceptionHandling>
+
</syntaxhighlight>
+
 
+
===appSettings===
+
 
+
In this section, the settings of the UBIK service can be specified. The settings are described in chapter [[UBIK_Web_Service_Configuration|UBIK Web Service Configuration]].
+
 
+
Example 1:
+
 
+
<syntaxhighlight lang="xml">
+
  <appSettings>
+
    <add key="UBIK.DataBase.ConnectionString" value="Data Source=ubikdbserver.mydomain;Initial Catalog=UBIK.MYDATABASE;User ID=myuser;Password=mypassword" />
+
    <add key="UBIK.Service.MaxIdleMinutes" value="5" />
+
    <add key="UBIK.Service.ValityPeriode" value="0" />
+
    <add key="UBIK.Service.TokenValityPeriode" value="300" />
+
    <add key="UBIK.Service.LogLevel" value="10" />
+
    <add key="UBIK.Service.UserRestrictive" value="1" />
+
    <add key="UBIK.Service.DeviceRestrictive" value="1" />
+
    <add key="UBIK.Service.TokenRestrictive" value="1" />
+
<add key="UBIK.Service.LanguageID" value="0" />
+
    <add key="UBIK.Service.SessionManagementType" value="0" />
+
    <add key="UBIK.Service.SessionManagementUrl" value="" />
+
  </appSettings>
+
</syntaxhighlight>
+
 
+
Example 2 (configured for an Microsoft Azure cloud database and a LAS service)
+
 
+
<syntaxhighlight lang="xml">
+
    <add key="UBIK.DataBase.ConnectionString" value="Data Source=tcp:xxxxxxxx.database.windows.net,1433;Initial Catalog=UBIK.MYDATABASE;User ID=mycluduser@xxxxxxxx;Password=mypassword" />
+
    <add key="UBIK.Service.MaxIdleMinutes" value="5" />
+
    <add key="UBIK.Service.ValityPeriode" value="0" />
+
    <add key="UBIK.Service.TokenValityPeriode" value="300" />
+
    <add key="UBIK.Service.LogLevel" value="10" />
+
    <add key="UBIK.Service.UserRestrictive" value="1" />
+
    <add key="UBIK.Service.DeviceRestrictive" value="1" />
+
    <add key="UBIK.Service.TokenRestrictive" value="1" />
+
<add key="UBIK.Service.LanguageID" value="0" />
+
    <add key="UBIK.Service.SessionManagementType" value="1" />
+
    <add key="UBIK.Service.SessionManagementUrl" value="https://myusamserver.mydomain/UBIK/USAM/USAM.svc/SOAP" />
+
</syntaxhighlight>
+
 
+
 
+
===system.web===
+
 
+
This does not have to be edited in general.
+
 
+
<syntaxhighlight lang="xml">
+
  <system.web>
+
    <customErrors mode="Off"/>
+
    <httpRuntime maxRequestLength="65536" />
+
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0" />
+
  </system.web>
+
</syntaxhighlight>
+
 
+
===system.serviceModel===
+
 
+
In this section the web services are configured:
+
* Behaviours for services and endpoints
+
* Bindings (provides different configurations for data services and endpoints)
+
* Services (used for the data service and the session management service)
+
* Clients (the client definition is used by the data service to connect to the session management service defined in the appSettings)
+
::The clinets endpoint addresses are ignored as they are replaced by the settings provided in appSettings at service runtime!
+
 
+
<syntaxhighlight lang="xml">
+
  <system.serviceModel>
+
<behaviors>
+
<serviceBehaviors>
+
<behavior name="httpBehavior">
+
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
+
<serviceMetadata httpsGetEnabled="true" />
+
<!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
+
<serviceDebug includeExceptionDetailInFaults="true" />
+
</behavior>
+
</serviceBehaviors>
+
<endpointBehaviors>
+
<behavior name="httpBehavior">
+
<webHttp />
+
</behavior>
+
</endpointBehaviors>
+
</behaviors>
+
<bindings>
+
<webHttpBinding>
+
<binding transferMode="Streamed"
+
    name="WebHttpBinding_UBIKContent"
+
sendTimeout="00:05:00"
+
            maxBufferPoolSize="67108864"
+
            maxReceivedMessageSize="67108864"
+
            maxBufferSize="67108864"
+
receiveTimeout="01:00:00">
+
<security mode="Transport">
+
<transport clientCredentialType="None" />
+
</security>
+
</binding>
+
</webHttpBinding>
+
<basicHttpBinding>
+
<binding name="BasicHttpBinding_IUSAM" closeTimeout="00:01:00"
+
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
+
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
+
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
+
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
+
          useDefaultWebProxy="true">
+
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
+
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
+
<security mode="None">
+
<transport clientCredentialType="None" proxyCredentialType="None"
+
              realm="" />
+
<message clientCredentialType="UserName" algorithmSuite="Default" />
+
</security>
+
</binding>
+
</basicHttpBinding>
+
<wsHttpBinding>
+
<binding name="WSHttpBinding_IUSAM" closeTimeout="00:01:00" openTimeout="00:01:00"
+
                receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
+
                transactionFlow="false" hostNameComparisonMode="StrongWildcard"
+
                maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
+
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
+
                allowCookies="false">
+
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
+
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
+
<reliableSession ordered="true" inactivityTimeout="00:10:00"
+
              enabled="false" />
+
<security mode="Transport">
+
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
+
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
+
</security>
+
</binding>
+
<binding name="WSHttpBinding_UBIKContent" maxReceivedMessageSize="67108864" receiveTimeout="01:00:00">
+
<security mode="Transport">
+
<transport clientCredentialType="None" />
+
</security>
+
</binding>
+
</wsHttpBinding>
+
</bindings>
+
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" />
+
<services>
+
<service name="UBIK.Service.UBIKContent" behaviorConfiguration="httpBehavior">
+
<endpoint address="" behaviorConfiguration="httpBehavior" binding="webHttpBinding" bindingConfiguration="WebHttpBinding_UBIKContent" contract="UBIK.Service.IUBIKContent" />
+
<endpoint address="/SOAP" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_UBIKContent" contract="UBIK.Service.IUBIKContent" />
+
</service>
+
<service name="UBIK.Service.USAM" behaviorConfiguration="httpBehavior">
+
<endpoint address=""      binding="webHttpBinding" behaviorConfiguration="httpBehavior"  bindingConfiguration="WebHttpBinding_UBIKContent" contract="UBIK.Service.IUSAM" />
+
<endpoint address="/SOAP" binding="wsHttpBinding"  bindingConfiguration="WSHttpBinding_IUSAM" contract="UBIK.Service.IUSAM" />
+
</service>
+
</services>
+
<client>
+
<endpoint address="a" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUSAM" contract="USAMService.IUSAM" name="BasicHttpBinding_IUSAM" />
+
<endpoint address="a" binding="wsHttpBinding"    bindingConfiguration="WSHttpBinding_IUSAM"    contract="USAMService.IUSAM" name="WSHttpBinding_IUSAM" />
+
</client>
+
</system.serviceModel>
+
</syntaxhighlight>
+
 
+
===system.webServer===
+
 
+
This does not have to edited in general.
+
 
+
<syntaxhighlight lang="xml">
+
  <system.webServer>
+
    <modules runAllManagedModulesForAllRequests="true" />
+
    <directoryBrowse enabled="true" />
+
    <validation validateIntegratedModeConfiguration="false" />
+
  </system.webServer>
+
</syntaxhighlight>
+

Latest revision as of 14:58, 12 May 2015