NLog.Web: Main() Error:System.ArgumentOutOfRangeException:“Index and count must refer to a location within the string.”

  • VS version:15.4.0
  • Windows version:Windows10
  • ASP.NET CORE:2.0
  • NLog:5.0.0-beta11
  • NLog.Web.AspNetCore:4.5.0-rc2

Program=>Main:

var logger = NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger();
try
 {
       logger.Debug("init main");
       BuildWebHost(args).Run();
}
catch (Exception e)
{
       logger.Error(e, "Stopped program because of exception");
        throw;
}

image

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

Well it seems to be a bug in System.Uri.ToString, so currently the work around is to use ASCII characters

I had the exact same problem. Turned out I had the Swedish character “ä” in one of my folders’ names.

The problem disappeared after changing this character to an “a” instead.