title: NLog prevents update database in ASP.NET Core
body: <p>I'm using NLog in my ASP.NET Core Web API project.
  I have and issue in <strong>Update-Database</strong> while using <strong>NLog</strong> <br >
  This is my NLog.Config file in my application :</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;nlog xmlns=&quot;http://www.nlog-project.org/schemas/NLog.xsd&quot;
        xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
        autoReload=&quot;true&quot;
        throwExceptions=&quot;true&quot;
        internalLogLevel=&quot;Trace&quot;
        internalLogFile=&quot;C:\Nlog\logs\internalLog.txt&quot;&gt;
  
      &lt;targets&gt;
          &lt;target xsi:type=&quot;Database&quot;
              name=&quot;dbTarget&quot;
              connectionString=&quot;${configsetting:item=ConnectionStrings.DefaultConnection}&quot;
              commandText=&quot;INSERT INTO [app].[TblApplicationLog](Logged,Message,Level,Exception,Logger,Url,UserName,ServerName,Ip,Controller,Action,Host,Application,Callsite,UserAuthenticated, Useragent)
                  VALUES (@datetime,@msg,@level,@exception,@logger,@url,@username,@servername,@ip,@controller,@action,@host,@application,@callsite,@userAuthenticated,@useragent)&quot;&gt;
              &lt;parameter name=&quot;@application&quot; layout=&quot;AspNetCoreNlog&quot; /&gt;
              &lt;parameter name=&quot;@datetime&quot; layout=&quot;${date}&quot; /&gt;
              &lt;parameter name=&quot;@msg&quot; layout=&quot;${message}&quot; /&gt;
              &lt;parameter name=&quot;@level&quot; layout=&quot;${level}&quot; /&gt;
              &lt;parameter name=&quot;@exception&quot; layout=&quot;${exception:innerFormat=Message,StackTrace}&quot; /&gt;
              &lt;!--&lt;parameter name=&quot;@trace&quot; layout=&quot;${stacktrace}&quot; /&gt;--&gt;
              &lt;parameter name=&quot;@callsite&quot; layout=&quot;${callsite}&quot; /&gt;
              &lt;parameter name=&quot;@logger&quot; layout=&quot;${logger}&quot; /&gt;
              &lt;parameter name=&quot;@url&quot; layout=&quot;${aspnet-request-url}&quot; /&gt;
              &lt;parameter name=&quot;@username&quot; layout=&quot;${aspnet-user-identity}&quot; /&gt;
              &lt;parameter name=&quot;@servername&quot; layout=&quot;${machinename}&quot; /&gt;
              &lt;parameter name=&quot;@ip&quot; layout=&quot;${aspnet-request-ip}&quot; /&gt;
              &lt;parameter name=&quot;@controller&quot; layout=&quot;${aspnet-mvc-controller}&quot; /&gt;
              &lt;parameter name=&quot;@action&quot; layout=&quot;${aspnet-mvc-action}&quot; /&gt;
              &lt;parameter name=&quot;@host&quot; layout=&quot;${aspnet-request-host}&quot; /&gt;
              &lt;parameter name=&quot;@useragent&quot; layout=&quot;${aspnet-request-useragent}&quot; /&gt;
              &lt;parameter name=&quot;@userAuthenticated&quot; layout=&quot;${aspnet-user-isauthenticated}&quot; /&gt;
          &lt;/target&gt;
      &lt;/targets&gt;
  
      &lt;rules&gt;
          &lt;logger name=&quot;*&quot; minlevel=&quot;Trace&quot; writeTo=&quot;dbTarget&quot; /&gt;
      &lt;/rules&gt;
  &lt;/nlog&gt;
  </code></pre>
  <p>Everything in logging works fine but if I add a new migration and wanna do <strong>update-database</strong>, I get following error in NuGet Package Manager Console:</p>
  <blockquote>
  <p>An error occurred while writing to logger(s). (Timeout expired.  The
  timeout period elapsed prior to completion of the operation or the
  server is not responding.)</p>
  </blockquote>
  <p><strong>Note: When I exclude the Nlog.config file from my solution, Update-Database works fine like always, but with including Nlog.config file in my solution, Update-database won't work anymore</strong></p>