I have some problem with program.cs new version in ASP.CORE 2.0
Here my code
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseKestrel()
.UseStartup<Startup>()
.UseConfiguration(new ConfigurationBuilder().AddCommandLine(args).Build())
.Build();
}
When i start project i has an error
System.FormatException: 'Could not parse the JSON file. Error on line number '0': ''.'
How to resolve it?
I had this problem and the reason is that for some reason Visual Studio saves files with some invisible metadata that goes before the text therefore JSON reader cannot parse it.
You need to
File -> Save As -> (Choose UTF-8 Without BOM)
.in m case I put extra { right before (above)
"ConnectionStrings" :
in appsettings.jsonI copied this from another file and assumed that
"ConnectionStrings" :
must inside a curly braces {}before
after