Activation error occured while trying to get instance of type LogWriter

Topics: Enterprise Library Core, Logging Application Block
Apr 21, 2010 at 2:43 PM

{"Resolution of the dependency failed, type = \"Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter\", name = \"(none)\".\r\nException occurred while: while resolving.\r\nException is: InvalidOperationException - The type Database cannot be constructed. You must configure the container to supply this value.\r\n-----------------------------------------------\r\nAt the time of the exception, the container was:\r\n\r\n  Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl,LogWriter.__default__ (mapped from

 

Can you help me ?

Apr 21, 2010 at 6:19 PM

You haven't configured the database correctly. Either the database name in your log writer is wrong, or the connection string is missing, or you haven't set the default database.

 

Apr 22, 2010 at 6:44 AM

This is my configuration (i seem that it's ok):

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
  <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="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />

    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections> 

  <dataConfiguration defaultDatabase="DBLog">
  </dataConfiguration>

  <connectionStrings>
    <add name="DBLog" connectionString="Data Source=xyz;Initial Catalog=gg2-log;Integrated security=true" providerName="System.Data.SqlClient" />
  </connectionStrings >

  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
      <add databaseInstanceName="DBLog"
        writeLogStoredProcName="WriteLog"
     addCategoryStoredProcName="AddCategory"
        formatter="Text Formatter"
     listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database,Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Database Trace Listener" />
    </listeners>
    <formatters>
      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
     type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="Data Access Events">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="Trace">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="Troubleshooting">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="UI Events">
        <listeners>
          <add name="Database Trace Listener" />
        </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="Database Trace Listener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
</configuration>

Apr 22, 2010 at 7:10 AM

Yes, it looks fine and works fine when I tried to resolve a LogWriter instance.

LogWriter logWriter = EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();

 Is this the configuration file of your host/executable project? Or is this from a class library?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 22, 2010 at 7:21 AM

My project is a WCF Service (web project).

When try to get instance via :

LogWriter logWriter = EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();

i've an error in the post title...

Thanks

Apr 22, 2010 at 7:34 AM

Ok, so I assume the config you posted is the one from the web.config file of the wcf service web project.  Could you debug how many Registrations are there in the EnterpriseLibraryContainer.Current object?  Using the config you posted, I was able to see 27 registrations.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 22, 2010 at 7:56 AM

I see 30 registration.

Apr 22, 2010 at 8:14 AM

Do you see the registration for the DBLog database?  Try running this code

IEnumerable<Database> databases = EnterpriseLibraryContainer.Current.GetAllInstances<Database>();

and see how many items will there be for the databases variable.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 22, 2010 at 8:27 AM

it is null.

 

Apr 22, 2010 at 8:31 AM

Sorry for asking again, but it really looks like the config file your wcf service reads is not the one that you posted.  Are you sure it is the web.config from the wcf service's project?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 22, 2010 at 8:42 AM

This is entire configuration file :

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

    <section name="DataManagerConfigurationSection"
  type="Configuration.DataManagerConfigurationSection, DataAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af"
  allowLocation="true" allowDefinition="Everywhere" />

    <!-- required to read the <dataCacheClient> element -->
    <section name="dataCacheClient"
       type="Microsoft.ApplicationServer.Caching.DataCacheClientSection,
            Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0,
            Culture=neutral, PublicKeyToken=31bf3856ad364e35"
       allowLocation="true"
       allowDefinition="Everywhere"/>

    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

  <!-- Inizio sezione diagnostics-->
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelMessageLoggingListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
      <source name="System.ServiceModel" switchValue="Warning, ActivityTracing" propagateActivity="true">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="D:\GG2\Log\Web.Services.ContractService_MessageLog.svclog"
     type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
     name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
      <add initializeData="D:\GG2\Log\Web.Services.ContractService_TraceLog.svclog"
     type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
     name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>
  <!-- Fine sezione diagnostics-->


  <DataManagerConfigurationSection StorageInitializationData="Data Source=xyz;Initial Catalog=GG2-910;Integrated security=true"
         DefaultCultureName="it-IT" />

  <!-- routing client-->
  <dataCacheClient>
    <hosts>
      <host
      name="AURORA"
      cachePort="22233"/>
    </hosts>
    <securityProperties mode="None" protectionLevel="None"/>
  </dataCacheClient>

  <appSettings>
    <add key="DefaultAppDomainName" value="Contracts" />
    <add key="urlResourceService" value="http://zyzz/services/GGResourceService/Resource.svc/Write" />
    <add key="useCache" value="true" />
    <add key="regionCache" value="Contracts_Dev" />
  </appSettings>

  <connectionStrings>
    <add name="DBLog" connectionString="Data Source=xyz;Initial Catalog=gg2-log;Integrated security=true" providerName="System.Data.SqlClient" />
  </connectionStrings >

  <system.web>
    <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
    <compilation debug="true">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>

    </compilation>
    <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Windows" />
    <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </controls>
    </pages>

    <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </httpModules>


  </system.web>

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
       type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
       type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="OptionInfer" value="true"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>

  <!--
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
     type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
     type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
  </system.webServer>

  <!--- WCF -->
  <system.serviceModel>
    <client>
      <!-- AUTHORIZATION -->
      <endpoint address="http://xyz/services/GGAuthenticationManager/AuthenticationManagerService.svc"
  binding="wsHttpBinding"
     bindingConfiguration="wsHttpBindingExt"
  contract="Contracts.IAuthenticationManager"
     name="AuthService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <!-- SECURITY -->
      <endpoint address="http://xyz/services/GGSecurityAdminService/SecurityAdminReaderService.svc"
     binding="wsHttpBinding"
     bindingConfiguration="wsHttpBindingExt"
     contract="Contracts.ISecurityAdminDataService"
     name="SecurityAdminReaderService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <!-- TYPE -->
      <endpoint address="http://xyz/services/GGTypeService/TypesService.svc"
  binding="customBinding"
     bindingConfiguration="customBindingExt"
  contract="Contracts.ITypesService"
     name="TypeService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <!-- NOTIFICATION -->
      <endpoint address="http://xyz:1634/services/GGNotificationService/"
    binding="basicHttpBinding"
    contract="Contracts.INotificationService"
    name="NotificationService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>

      <!-- Puntamento al ticket dal servizio listener -->
      <endpoint address="http://xyz/services/GGWorkflowTicket/WFTicket.svc/nosec"
       behaviorConfiguration="endpointBehaviorNoCertificateValidation"
       binding="wsHttpContextBinding"
       bindingConfiguration="wsHttpContextBindingExt"
       contract="Contracts.ITicket"
       name="WFTicketService">
        <identity>
          <certificate encodedValue="AwAAAAEAAAAUAAAARHCWVD7tTTYHjye3BDPpEMPov9ggAAAAAQAAABACAAAwggIMMIIBdaADAgECAhCXwnqLK7Vpt0LFixj1DZA/MA0GCSqGSIb3DQEBBAUAMBMxETAPBgNVBAMTCERlY2FSb290MB4XDTA5MDExNjA5NDM1NFoXDTM5MTIzMTIzNTk1OVowFzEVMBMGA1UEAxMMRGVjYVNlcnZpY2VzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/9YZGhCrE+JRi3Xd3k04pVKJBUOslUnKTIlij6+KBme09xNku53mJFidsFCXfn/dMZ9916YyAqdcxrymcmJ+iQurrez5JeOYvHeaGjVuYnEmBiQFtUeUjjwx0R5OF+FXXgr1imaUxBdp+O2n/ZpvLYYS8+m2HhhIanjr7lXAE5QIDAQABo10wWzATBgNVHSUEDDAKBggrBgEFBQcDATBEBgNVHQEEPTA7gBCnHi2MkJrIRAsZshP8UCI2oRUwEzERMA8GA1UEAxMIRGVjYVJvb3SCEC4d7/AMio+SS+LkLzXTOMkwDQYJKoZIhvcNAQEEBQADgYEADhGV15xXVqeyeuX4khaY+ByzhcaIlPAFL4rKBP/yb4o2CzoYezt/YavL9N0NiGu4GEopVCo0QC1sKcL7t1pFeSemfgZaDRw4Kr0+6CGkNrIHyHFjSYgnI21MQOOopqgRIumCJ39U7Io32UdAazF7KWUKGUPjGotV9io1voEjmKw=" />
        </identity>
      </endpoint>
    </client>
    <bindings>
      <customBinding>
        <binding name="customBindingExt" sendTimeout="00:10:00">
          <internationalization defaultCulture="it-IT" />
          <httpTransport manualAddressing="false" maxBufferPoolSize="524288"
             maxReceivedMessageSize="1000000" allowCookies="false" authenticationScheme="Anonymous"
             bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
             keepAliveEnabled="true" maxBufferSize="1000000" proxyAuthenticationScheme="Anonymous"
             realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
             useDefaultWebProxy="true" />
        </binding>
        <binding name="customBindingExtSecure" sendTimeout="00:10:00">
          <security authenticationMode="UserNameForCertificate">
          </security>
          <internationalization defaultCulture="it-IT" />
          <httpTransport authenticationScheme="Anonymous" bypassProxyOnLocal="false"
       hostNameComparisonMode="StrongWildcard" proxyAuthenticationScheme="Anonymous"
       realm="" useDefaultWebProxy="true">
          </httpTransport>
        </binding>
        <binding name="customBindingExtSecureMessageHeader" sendTimeout="00:10:00">
          <security authenticationMode="AnonymousForCertificate">
            <secureConversationBootstrap />
          </security>
          <internationalization defaultCulture="it-IT" />
          <httpTransport authenticationScheme="Anonymous" bypassProxyOnLocal="false"
       hostNameComparisonMode="StrongWildcard" proxyAuthenticationScheme="Anonymous"
       realm="" useDefaultWebProxy="true">
          </httpTransport>
        </binding>
      </customBinding>
      <wsHttpBinding>
        <binding name="wsHttpBindingExt">
          <security mode="None">
          </security>
        </binding>
        <binding name="wsHttpBindingExtSecure">
          <security mode="Message">
            <message clientCredentialType="UserName" />
          </security>
        </binding>
        <binding name="wsHttpBindingExtTransaction" transactionFlow="true">
          <security mode="None" />
        </binding>
        <binding name="wsHttpBindingExtSecureTransaction" transactionFlow="true">
          <security mode="Message">
            <transport clientCredentialType="Certificate" />
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </wsHttpBinding>
      <wsHttpContextBinding>
        <binding name="wsHttpContextBindingExt" 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="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
      enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
       realm="">
            </transport>
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
       establishSecurityContext="true" />
          </security>
        </binding>
      </wsHttpContextBinding>
    </bindings>
    <extensions>
      <behaviorExtensions>
        <add name="InternationalizationBehavior" type="InternalizationBehaviorSection, Protocols, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af" />
      </behaviorExtensions>
      <bindingElementExtensions>
        <add name="internationalization" type="InternationalizationElement, Protocols, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af" />
      </bindingElementExtensions>
    </extensions>

    <diagnostics>
      <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
    </diagnostics>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>

      <!-- CONTRACT-->
      <service behaviorConfiguration="ServiceBehavior" name="ContractReaderService">
        <endpoint
      address=""
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecure"
      contract="Contracts.IContractDataReader">
        </endpoint>

        <endpoint
      address="nosec"
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecureMessageHeader"
      contract="Contracts.IContractDataReader">
        </endpoint>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

      <service behaviorConfiguration="ServiceBehavior" name="ContractWriterService">
        <endpoint
      address=""
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecure"
      contract="Contracts.IContractDataWriter">
        </endpoint>

        <endpoint
      address="nosec"
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecureMessageHeader"
      contract="Contracts.IContractDataWriter">
        </endpoint>

        <endpoint
      address="transaction"
       binding="wsHttpBinding"
       bindingConfiguration="wsHttpBindingExtTransaction"
       contract="Contracts.IContractDataWriter">
        </endpoint>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

      <!-- TicketScheduler-->
      <service name="TicketSchedulerService" behaviorConfiguration="ServiceBehaviorSchedulerTicket">
        <endpoint
      address=""
      binding="basicHttpBinding"
      contract="Contracts.ITicketScheduler">
        </endpoint>
      </service>

      <!-- TicketAdmin-->
      <service behaviorConfiguration="ServiceBehavior" name="TicketAdminService">
        <endpoint
      address=""
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecure"
      contract="Contracts.ITicketAdmin">
        </endpoint>


        <endpoint
      address="nosec"
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecureMessageHeader"
      contract="Contracts.ITicketAdmin">
        </endpoint>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <behaviors>
      <endpointBehaviors>
        <behavior name="endpointBehaviorNoCertificateValidation">
          <clientCredentials>
            <serviceCertificate>
              <authentication certificateValidationMode="None"   revocationMode="NoCheck"  />
            </serviceCertificate>
          </clientCredentials>
        </behavior>
        <behavior name="InternationalizationEndPointBehavior">
          <InternationalizationBehavior />
        </behavior>
      </endpointBehaviors>

      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />

          <serviceAuthorization principalPermissionMode="Custom"
        serviceAuthorizationManagerType="Contracts.ServiceAuthorization, Contracts,Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af">
            <authorizationPolicies>
              <add policyType="Contracts.ClaimsPermissionPolicy, Contracts,Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af" />
            </authorizationPolicies>
          </serviceAuthorization>

          <serviceCredentials>
            <serviceCertificate findValue="Services" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />

            <userNameAuthentication userNamePasswordValidationMode="Custom"
                 customUserNamePasswordValidatorType="Contracts.UserNamePasswordValidator, Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af" />
          </serviceCredentials>
        </behavior>

        <behavior name="ServiceBehaviorSchedulerTicket">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
   defaultCategory="General" logWarningsWhenNoCategoriesMatch="false">
    <listeners>
      <add databaseInstanceName="DBLog" writeLogStoredProcName="WriteLog"
     addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
     listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Database Trace Listener" />
      <add toAddress="report-bug@xyz.com" fromAddress="gg2-logger@dxyz.com"
     subjectLineStarter="start" subjectLineEnder="end" smtpServer="mail.xyz.com"
     smtpPort="25" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Email TraceListener" />
      <add source="Services" formatter="Text Formatter" log="" machineName="."
     listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Event Log Destination" />
      <add fileName="D:\Log\WebServicesContract.log" header="----------------header------------------------"
     footer="----------------footer------------------------" formatter="Text Formatter"
     listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Flat File Destination" />
    </listeners>
    <formatters>
      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
     type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Text Formatter" />
    </formatters>
    <logFilters>
      <add categoryFilterMode="AllowAllExceptDenied" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.CategoryFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Category">
        <categoryFilters>
          <add name="UI Events" />
        </categoryFilters>
      </add>
      <add minimumPriority="2" maximumPriority="2147483647" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.PriorityFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Priority" />
      <add enabled="true" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.LogEnabledFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="LogEnabled Filter" />
    </logFilters>
    <categorySources>
      <add switchValue="All" name="Data Access Events">
        <listeners>
          <add name="Flat File Destination" />
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Flat File Destination" />
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="Trace">
        <listeners>
          <add name="Flat File Destination" />
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="Troubleshooting">
        <listeners>
          <add name="Flat File Destination" />
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="UI Events">
        <listeners>
          <add name="Flat File Destination" />
          <add name="Database Trace Listener" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category">
        <listeners>
          <add name="Flat File Destination" />
          <add name="Database Trace Listener" />
        </listeners>
      </notProcessed>
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Flat File Destination" />
          <add name="Database Trace Listener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
</configuration>

Apr 22, 2010 at 9:48 AM

I just got an exception using this config you just posted but that is due the location of the filename specified in one of the trace listeners which does not exists on my machine.

Could you post the full exception message including the stack trace? 

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 22, 2010 at 11:43 AM

Can you leave only the database listener ?

Thanks

Apr 22, 2010 at 11:48 AM

That was your initial config and I already tried it out.  i can successfully resolve a LogWriter as I posted above.

Apr 22, 2010 at 12:18 PM

You can try with this file ? i've the same error..

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

    <section name="DataManagerConfigurationSection"
  type="Configuration.DataManagerConfigurationSection, DataAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af"
  allowLocation="true" allowDefinition="Everywhere" />

    <!-- required to read the <dataCacheClient> element -->
    <section name="dataCacheClient"
       type="Microsoft.ApplicationServer.Caching.DataCacheClientSection,
            Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0,
            Culture=neutral, PublicKeyToken=31bf3856ad364e35"
       allowLocation="true"
       allowDefinition="Everywhere"/>

    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

  <!-- Inizio sezione diagnostics-->
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelMessageLoggingListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
      <source name="System.ServiceModel" switchValue="Warning, ActivityTracing" propagateActivity="true">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="D:\GG2\Log\Web.Services.ContractService_MessageLog.svclog"
     type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
     name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
      <add initializeData="D:\GG2\Log\Web.Services.ContractService_TraceLog.svclog"
     type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
     name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>
  <!-- Fine sezione diagnostics-->


  <DataManagerConfigurationSection StorageInitializationData="Data Source=xyz;Initial Catalog=GG2-910;Integrated security=true"
         DefaultCultureName="it-IT" />

  <!-- routing client-->
  <dataCacheClient>
    <hosts>
      <host
      name="AURORA"
      cachePort="22233"/>
    </hosts>
    <securityProperties mode="None" protectionLevel="None"/>
  </dataCacheClient>

  <appSettings>
    <add key="DefaultAppDomainName" value="xyz" />
    <add key="urlResourceService" value="http://xyz/services/GGResourceService/Resource.svc/Write" />
    <add key="useCache" value="true" />
    <add key="regionCache" value="Contracts_Dev" />
  </appSettings>

  <connectionStrings>
    <add name="DBLog" connectionString="Data Source=xyz;Initial Catalog=gg2-log;Integrated security=true" providerName="System.Data.SqlClient" />
  </connectionStrings >

  <system.web>
    <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
    <compilation debug="true">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>

    </compilation>
    <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Windows" />
    <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </controls>
    </pages>

    <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </httpModules>


  </system.web>

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
       type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
       type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="OptionInfer" value="true"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>

  <!--
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
     type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
     type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
  </system.webServer>

  <!--- WCF -->
  <system.serviceModel>
    <client>
      <!-- AUTHORIZATION -->
      <endpoint address="http://xyz/services/GGAuthenticationManager/AuthenticationManagerService.svc"
  binding="wsHttpBinding"
     bindingConfiguration="wsHttpBindingExt"
  contract="Contracts.IAuthenticationManager"
     name="AuthService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <!-- SECURITY -->
      <endpoint address="http://xyz/services/GGSecurityAdminService/SecurityAdminReaderService.svc"
     binding="wsHttpBinding"
     bindingConfiguration="wsHttpBindingExt"
     contract="Contracts.ISecurityAdminDataService"
     name="SecurityAdminReaderService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <!-- TYPE -->
      <endpoint address="http://xyz/services/GGTypeService/TypesService.svc"
  binding="customBinding"
     bindingConfiguration="customBindingExt"
  contract="Contracts.ITypesService"
     name="TypeService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <!-- NOTIFICATION -->
      <endpoint address="http://xyz:1634/services/GGNotificationService/"
    binding="basicHttpBinding"
    contract="Contracts.INotificationService"
    name="NotificationService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>

      <!-- Puntamento al ticket dal servizio listener -->
      <endpoint address="http://xyz/services/GGWorkflowTicket/WFTicket.svc/nosec"
       behaviorConfiguration="endpointBehaviorNoCertificateValidation"
       binding="wsHttpContextBinding"
       bindingConfiguration="wsHttpContextBindingExt"
       contract="Contracts.ITicket"
       name="WFTicketService">
        <identity>
          <certificate encodedValue="AwAAAAEAAAAUAAAARHCWVD7tTTYHjye3BDPpEMPov9ggAAAAAQAAABACAAAwggIMMIIBdaADAgECAhCXwnqLK7Vpt0LFixj1DZA/MA0GCSqGSIb3DQEBBAUAMBMxETAPBgNVBAMTCERlY2FSb290MB4XDTA5MDExNjA5NDM1NFoXDTM5MTIzMTIzNTk1OVowFzEVMBMGA1UEAxMMRGVjYVNlcnZpY2VzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/9YZGhCrE+JRi3Xd3k04pVKJBUOslUnKTIlij6+KBme09xNku53mJFidsFCXfn/dMZ9916YyAqdcxrymcmJ+iQurrez5JeOYvHeaGjVuYnEmBiQFtUeUjjwx0R5OF+FXXgr1imaUxBdp+O2n/ZpvLYYS8+m2HhhIanjr7lXAE5QIDAQABo10wWzATBgNVHSUEDDAKBggrBgEFBQcDATBEBgNVHQEEPTA7gBCnHi2MkJrIRAsZshP8UCI2oRUwEzERMA8GA1UEAxMIRGVjYVJvb3SCEC4d7/AMio+SS+LkLzXTOMkwDQYJKoZIhvcNAQEEBQADgYEADhGV15xXVqeyeuX4khaY+ByzhcaIlPAFL4rKBP/yb4o2CzoYezt/YavL9N0NiGu4GEopVCo0QC1sKcL7t1pFeSemfgZaDRw4Kr0+6CGkNrIHyHFjSYgnI21MQOOopqgRIumCJ39U7Io32UdAazF7KWUKGUPjGotV9io1voEjmKw=" />
        </identity>
      </endpoint>
    </client>
    <bindings>
      <customBinding>
        <binding name="customBindingExt" sendTimeout="00:10:00">
          <internationalization defaultCulture="it-IT" />
          <httpTransport manualAddressing="false" maxBufferPoolSize="524288"
             maxReceivedMessageSize="1000000" allowCookies="false" authenticationScheme="Anonymous"
             bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
             keepAliveEnabled="true" maxBufferSize="1000000" proxyAuthenticationScheme="Anonymous"
             realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
             useDefaultWebProxy="true" />
        </binding>
        <binding name="customBindingExtSecure" sendTimeout="00:10:00">
          <security authenticationMode="UserNameForCertificate">
          </security>
          <internationalization defaultCulture="it-IT" />
          <httpTransport authenticationScheme="Anonymous" bypassProxyOnLocal="false"
       hostNameComparisonMode="StrongWildcard" proxyAuthenticationScheme="Anonymous"
       realm="" useDefaultWebProxy="true">
          </httpTransport>
        </binding>
        <binding name="customBindingExtSecureMessageHeader" sendTimeout="00:10:00">
          <security authenticationMode="AnonymousForCertificate">
            <secureConversationBootstrap />
          </security>
          <internationalization defaultCulture="it-IT" />
          <httpTransport authenticationScheme="Anonymous" bypassProxyOnLocal="false"
       hostNameComparisonMode="StrongWildcard" proxyAuthenticationScheme="Anonymous"
       realm="" useDefaultWebProxy="true">
          </httpTransport>
        </binding>
      </customBinding>
      <wsHttpBinding>
        <binding name="wsHttpBindingExt">
          <security mode="None">
          </security>
        </binding>
        <binding name="wsHttpBindingExtSecure">
          <security mode="Message">
            <message clientCredentialType="UserName" />
          </security>
        </binding>
        <binding name="wsHttpBindingExtTransaction" transactionFlow="true">
          <security mode="None" />
        </binding>
        <binding name="wsHttpBindingExtSecureTransaction" transactionFlow="true">
          <security mode="Message">
            <transport clientCredentialType="Certificate" />
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </wsHttpBinding>
      <wsHttpContextBinding>
        <binding name="wsHttpContextBindingExt" 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="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
      enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
       realm="">
            </transport>
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
       establishSecurityContext="true" />
          </security>
        </binding>
      </wsHttpContextBinding>
    </bindings>
    <extensions>
      <behaviorExtensions>
        <add name="InternationalizationBehavior" type="Protocols.InternalizationBehaviorSection, Protocols, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af" />
      </behaviorExtensions>
      <bindingElementExtensions>
        <add name="internationalization" type="Protocols.InternationalizationElement, Protocols, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af" />
      </bindingElementExtensions>
    </extensions>

    <diagnostics>
      <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
    </diagnostics>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>

      <!-- CONTRACT-->
      <service behaviorConfiguration="ServiceBehavior" name="ContractReaderService">
        <endpoint
      address=""
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecure"
      contract="Contracts.IContractDataReader">
        </endpoint>

        <endpoint
      address="nosec"
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecureMessageHeader"
      contract="Contracts.IContractDataReader">
        </endpoint>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

      <service behaviorConfiguration="ServiceBehavior" name="ContractWriterService">
        <endpoint
      address=""
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecure"
      contract="Contracts.IContractDataWriter">
        </endpoint>

        <endpoint
      address="nosec"
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecureMessageHeader"
      contract="Contracts.IContractDataWriter">
        </endpoint>

        <endpoint
      address="transaction"
       binding="wsHttpBinding"
       bindingConfiguration="wsHttpBindingExtTransaction"
       contract="Contracts.IContractDataWriter">
        </endpoint>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

      <!-- TicketScheduler-->
      <service name="TicketSchedulerService" behaviorConfiguration="ServiceBehaviorSchedulerTicket">
        <endpoint
      address=""
      binding="basicHttpBinding"
      contract="Contracts.ITicketScheduler">
        </endpoint>
      </service>

      <!-- TicketAdmin-->
      <service behaviorConfiguration="ServiceBehavior" name="TicketAdminService">
        <endpoint
      address=""
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecure"
      contract="Contracts.ITicketAdmin">
        </endpoint>


        <endpoint
      address="nosec"
      behaviorConfiguration="InternationalizationEndPointBehavior"
      binding="customBinding"
      bindingConfiguration="customBindingExtSecureMessageHeader"
      contract="Contracts.ITicketAdmin">
        </endpoint>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <behaviors>
      <endpointBehaviors>
        <behavior name="endpointBehaviorNoCertificateValidation">
          <clientCredentials>
            <serviceCertificate>
              <authentication certificateValidationMode="None"   revocationMode="NoCheck"  />
            </serviceCertificate>
          </clientCredentials>
        </behavior>
        <behavior name="InternationalizationEndPointBehavior">
          <InternationalizationBehavior />
        </behavior>
      </endpointBehaviors>

      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />

          <serviceAuthorization principalPermissionMode="Custom"
        serviceAuthorizationManagerType="Contracts.ServiceAuthorization, Contracts,Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af">
            <authorizationPolicies>
              <add policyType="Contracts.ClaimsPermissionPolicy, Contracts,Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af" />
            </authorizationPolicies>
          </serviceAuthorization>

          <serviceCredentials>
            <serviceCertificate findValue="Services" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />

            <userNameAuthentication userNamePasswordValidationMode="Custom"
                 customUserNamePasswordValidatorType="Contracts.UserNamePasswordValidator,Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc786b77e9edb6af" />
          </serviceCredentials>
        </behavior>

        <behavior name="ServiceBehaviorSchedulerTicket">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
   defaultCategory="General" logWarningsWhenNoCategoriesMatch="false">
    <listeners>
      <add databaseInstanceName="DBLog" writeLogStoredProcName="WriteLog"
     addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
     listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Database Trace Listener" />
      <add fileName="D:\GG2\Log\WebServicesContract.log" header="----------------header------------------------"
     footer="----------------footer------------------------" formatter="Text Formatter"
     listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Flat File Destination" />
    </listeners>
    <formatters>
      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
     type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Text Formatter" />
    </formatters>
    <logFilters>
      <add categoryFilterMode="AllowAllExceptDenied" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.CategoryFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Category">
        <categoryFilters>
          <add name="UI Events" />
        </categoryFilters>
      </add>
      <add minimumPriority="2" maximumPriority="2147483647" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.PriorityFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Priority" />
      <add enabled="true" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.LogEnabledFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="LogEnabled Filter" />
    </logFilters>
    <categorySources>
      <add switchValue="All" name="Data Access Events">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="Trace">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="Troubleshooting">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="UI Events">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </notProcessed>
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
</configuration>

 

Apr 22, 2010 at 12:36 PM

I only copied the connectionStrings , and loggingConfiguration sections.  With this, this will fail as the default database wasn't set.  Your first post of the config works for me because the defaultDatabase was set.  This last version you posted didn't even have the dataConfiguration section

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 22, 2010 at 12:39 PM

sorry. i've added dataConfiguration section but do not are correclty...

Apr 22, 2010 at 12:50 PM

Sorry, this is another config file, and not execute correcly too.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>

  <dataConfiguration defaultDatabase="DBLog">
  </dataConfiguration>

  <connectionStrings>
    <add name="DBLog" connectionString="Data Source=xyz.deca.local;Initial Catalog=gg2-log;Integrated security=true" providerName="System.Data.SqlClient" />
  </connectionStrings >

  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
   defaultCategory="General" logWarningsWhenNoCategoriesMatch="false">
    <listeners>
      <add databaseInstanceName="DBLog" writeLogStoredProcName="WriteLog"
     addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
     listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Database Trace Listener" />
      <add fileName="D:\GG2\Log\WebServicesContract.log" header="----------------header------------------------"
     footer="----------------footer------------------------" formatter="Text Formatter"
     listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Flat File Destination" />
    </listeners>
    <formatters>
      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
     type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Text Formatter" />
    </formatters>
    <logFilters>
      <add categoryFilterMode="AllowAllExceptDenied" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.CategoryFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Category">
        <categoryFilters>
          <add name="UI Events" />
        </categoryFilters>
      </add>
      <add minimumPriority="2" maximumPriority="2147483647" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.PriorityFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Priority" />
      <add enabled="true" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.LogEnabledFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="LogEnabled Filter" />
    </logFilters>
    <categorySources>
      <add switchValue="All" name="Data Access Events">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="Trace">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="Troubleshooting">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="UI Events">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </notProcessed>
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
</configuration>

Apr 22, 2010 at 12:50 PM
Edited Apr 22, 2010 at 12:56 PM

Can you repro this on a very simple project and send it to me?  In the process, you might be able to figure out what's wrong.  I think we're just missing a small detail here

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 22, 2010 at 1:02 PM

The last config file is an minimal, to log exception into db

thanks

Apr 22, 2010 at 1:08 PM

But I can't repro with the config you posted.  Can't you post the full exception message and stack trace?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 22, 2010 at 1:16 PM

{"Resolution of the dependency failed, type = \"Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter\", name = \"(none)\".\r\nException occurred while: while resolving.\r\nException is: InvalidOperationException - The type Database cannot be constructed. You must configure the container to supply this value.\r\n-----------------------------------------------\r\nAt the time of the exception, the container was:\r\n\r\n  Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl,LogWriter.__default__ (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter, (none))\r\n  Resolving parameter \"structureHolder\" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl(Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder structureHolder, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider, Microsoft.Practices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator updateCoordinator)\r\n    Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,LogWriterStructureHolder.__default__ (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder, (none))\r\n    Resolving parameter \"traceSources\" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder(System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.Logging.Filters.ILogFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] filters, System.Collections.Generic.IEnumerable`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] traceSourceNames, System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.Logging.LogSource, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] traceSources, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource allEventsTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource notProcessedTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource errorsTraceSource, System.String defaultCategory, System.Boolean tracingEnabled, System.Boolean logWarningsWhenNoCategoriesMatch, System.Boolean revertImpersonation)\r\n      Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogSource,Data Access Events\r\n      Resolving parameter \"traceListeners\" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogSource(System.String name, System.Collections.Generic.IEnumerable`1[[System.Diagnostics.TraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] traceListeners, System.Diagnostics.SourceLevels level, System.Boolean autoFlush, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider)\r\n        Resolving Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.ReconfigurableTraceListenerWrapper,Database Trace Listener (mapped from System.Diagnostics.TraceListener, Database Trace Listener)\r\n        Resolving parameter \"wrappedTraceListener\" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.ReconfigurableTraceListenerWrapper(System.Diagnostics.TraceListener wrappedTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator coordinator)\r\n          Resolving Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener,Database Trace Listener‌implementation (mapped from System.Diagnostics.TraceListener, Database Trace Listener‌implementation)\r\n          Resolving parameter \"database\" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener(Microsoft.Practices.EnterpriseLibrary.Data.Database database, System.String writeLogStoredProcName, System.String addCategoryStoredProcName, Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.ILogFormatter formatter)\r\n            Resolving Microsoft.Practices.EnterpriseLibrary.Data.Database,DBLog\r\n"}

Apr 23, 2010 at 12:07 AM

Could you try removing first the database trace listener and then see if you can resolve a LogWriter?  If you can, check the TraceSources property if each item corresponds to the each categories defined in the config.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 23, 2010 at 7:05 AM

Hi, i've deleted the database listener, so the listener are :

    <listeners>
      <add fileName="D:\GG2\Log\WebServicesContract.log" header="----------------header------------------------"
     footer="----------------footer------------------------" formatter="Text Formatter"
     listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     name="Flat File Destination" />
    </listeners>

but i've the same error while try to resolve a LogWriter...

"Resolution of the dependency failed, type = \"Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter\", name = \"(none)\".\r\nException occurred while: while resolving.\r\nException is: InvalidOperationException -
The type TraceListener cannot be constructed. You must configure the container to supply this value.\r\n-"

Thanks

Apr 23, 2010 at 12:03 PM

Weird, it is indeed working from our end...Btw, are you already using VS2010 here?

Apr 23, 2010 at 12:35 PM

Hi, i use vs.net 2008.

Vs.net 2008 is an prerequisite for use EntLib 5.0 ?

 

Thanks

Apr 25, 2010 at 11:52 PM

No, not really.  Could you try the 2 other ways of resolving from a container instead of resolving from EnterpriseLibraryContainer.Current?  See if you can resolve a LogWriter and a Database object. 

var container = new UnityContainer()
                .AddNewExtension<EnterpriseLibraryCoreExtension>();
//container.Resolve...
var container = new UnityContainer();
var configurator = new UnityContainerConfigurator(container);
// Read the configuration files and set up the container.
EnterpriseLibraryContainer.ConfigureContainer(configurator, new FileConfigurationSource("path to web.config");
									      //Make sure to pass the correct path of the web.config here
//container.Resolve....

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 26, 2010 at 7:24 AM

Hi, i try to retrieve the LogWriter object via :

 var container = new UnityContainer()

.AddNewExtension<EnterpriseLibraryCoreExtension>(); 

LogWriter log = container.Resolve <LogWriter>();

 

but i've thsi error...

Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type Database cannot be constructed. You must configure the container to supply this value.
-----------------------------------------------
At the time of the exception, the container was:

  Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl,LogWriter.__default__ (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter, (none))
  Resolving parameter "structureHolder" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl(Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder structureHolder, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider, Microsoft.Practices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator updateCoordinator)
    Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,LogWriterStructureHolder.__default__ (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder, (none))
    Resolving parameter "traceSources" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder(System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.Logging.Filters.ILogFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] filters, System.Collections.Generic.IEnumerable`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] traceSourceNames, System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.Logging.LogSource, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] traceSources, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource allEventsTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource notProcessedTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource errorsTraceSource, System.String defaultCategory, System.Boolean tracingEnabled, System.Boolean logWarningsWhenNoCategoriesMatch, System.Boolean revertImpersonation)
      Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogSource,Data Access Events
      Resolving parameter "traceListeners" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogSource(System.String name, System.Collections.Generic.IEnumerable`1[[System.Diagnostics.TraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] traceListeners, System.Diagnostics.SourceLevels level, System.Boolean autoFlush, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider)
        Resolving Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.ReconfigurableTraceListenerWrapper,Database Trace Listener (mapped from System.Diagnostics.TraceListener, Database Trace Listener)
        Resolving parameter "wrappedTraceListener" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.ReconfigurableTraceListenerWrapper(System.Diagnostics.TraceListener wrappedTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator coordinator)
          Resolving Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener,Database Trace Listener‌implementation (mapped from System.Diagnostics.TraceListener, Database Trace Listener‌implementation)
          Resolving parameter "database" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener(Microsoft.Practices.EnterpriseLibrary.Data.Database database, System.String writeLogStoredProcName, System.String addCategoryStoredProcName, Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.ILogFormatter formatter)
            Resolving Microsoft.Practices.EnterpriseLibrary.Data.Database,DBLog

Apr 26, 2010 at 7:31 AM

Please try the second approach I posted above.

Apr 26, 2010 at 7:37 AM

I've try this :

var container = new UnityContainer();
            var configurator = new UnityContainerConfigurator(container);// Read the configuration files and set up the container.
           
            EnterpriseLibraryContainer.ConfigureContainer(configurator, new FileConfigurationSource("D:\\Work\\GlobalGest2.0\\Dev\\Source\\SERVICES\\ContractService\\Deca.GlobalGest.Web.Services.ContractService\\web.config"));

            LogWriter log = container.Resolve <LogWriter>();

 

but i've the same error.

Apr 26, 2010 at 7:40 AM

I strongly suggest you try to repro this on a small project and send it to us since we can't really repro it on our end.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 26, 2010 at 8:14 AM

I sent you the email

Thanks

Apr 26, 2010 at 8:28 AM

Great, but I haven't received it yet.  Are you using gmail?  It usually blocks attachments even .zip files.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 26, 2010 at 8:34 AM

hi, i've re-send the mail.

 

Apr 26, 2010 at 8:46 AM

It's still not on our inbox.  Could you send me an email without an attachment?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 26, 2010 at 9:09 AM

send

thanks

Apr 26, 2010 at 9:28 AM
Actually, I got a different error message in the solution you gave me. It's the Invalid TraceListenerData type in configuration 'listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData...."
Adding the Microsoft.Practices.EnterpriseLibrary.Logging.Database assembly fixes the problem and I was able to successfully resolve an instance of LogWriter object.

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 28, 2010 at 5:16 AM

Update:

Found out that this happens when the Data assembly is referenced from GAC.  Details and workaround can be found here - http://entlib.codeplex.com/WorkItem/View.aspx?WorkItemId=26903

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 1, 2010 at 11:16 AM

Hi there,

 

   I have a scenario where I am creating my ASP.Net application and a seperate dll application for logging with it's own app.config file:

 

ASP.Net web.config refers to app.config of logging application as below:

 

<

 

appSettings file="C:\Users\nischal.sathya\Documents\Visual Studio 2008\Projects\Facade\Facade\bin\Debug\Facade.dll.config"

>

</

 

 

 

appSettings

>

 

 

 

In the logging application the app.config is as below:

<?

xml version="1.0" encoding="utf-8"

?>

<

configuration

>

<

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"

/>

</

configSections

>

<

loggingConfiguration name="" tracingEnabled="true" defaultCategory="General"

>

<

listeners

>

<

add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

 

listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

 

source="EnterpriseLibraryLogging" formatter="Text Formatter"

 

log="Application" machineName="." traceOutputOptions="Timestamp, ProcessId, ThreadId, Callstack"

/>

<

add name="Message Queuing Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.MsmqTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

 

listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.MsmqTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

 

queuePath=".\Private$\pocmsmq" formatter="Text Formatter"

 

recoverable="true" useDeadLetterQueue="true" transactionType="Automatic"

 

traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId"

/>

</

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 Formatter"

/>

</

formatters

>

<

categorySources

>

<

add switchValue="All" name="General"

>

<

listeners

>

<

add name="Event Log Listener"

/>

<

add name="Message Queuing Trace Listener"

/>

</

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="Event Log Listener"

/>

<

add name="Message Queuing Trace Listener"

/>

</

listeners

>

</

errors

>

</

specialSources

>

</

loggingConfiguration

>

</

configuration

 

************************************************************************

For some reason during instantiation of

 

public void Write(Guid ActivityId, Logtype Logtype, string Application, string payload, string message)

{

<font size="2">

writer =

</font>EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();

.....

}

throws an error:

{"Activation error occured while trying to get instance of type LogWriter, key \"\""}

 

>

Jun 2, 2010 at 12:46 AM

My answer is on this thread.

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@Avanade.com