Search code examples
c#wcfloggingenterprise-library

How to use database logging for a WCF Service application using Enterprise Library 6


For Enterprise Library 6 logging we need to add below mentioned line in Startup.cs for Web application,then only we can able use database logging.

DatabaseFactory.SetDatabaseProviderFactory(new DatabaseProviderFactory());

Same way, where should I add the above mentioned line for WCF Service application to use database logging???


Solution

  • We need to add Global.asax inside WCF Service application,then use the below mentioned code

    protected void Application_Start(object sender, EventArgs e)
    {
       DatabaseFactory.SetDatabaseProviderFactory(new DatabaseProviderFactory());
    }
    

    Then everything will work perfectly...enjoy