Update Program.cs (#9988)
parent
28f0f5459e
commit
ad6e6062bd
|
@ -15,16 +15,17 @@ namespace SampleApp
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var isService = !(Debugger.IsAttached || args.Contains("--console"));
|
var isService = !(Debugger.IsAttached || args.Contains("--console"));
|
||||||
var builder = CreateWebHostBuilder(
|
|
||||||
args.Where(arg => arg != "--console").ToArray());
|
|
||||||
|
|
||||||
if (isService)
|
if (isService)
|
||||||
{
|
{
|
||||||
var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
|
var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
|
||||||
var pathToContentRoot = Path.GetDirectoryName(pathToExe);
|
var pathToContentRoot = Path.GetDirectoryName(pathToExe);
|
||||||
builder.UseContentRoot(pathToContentRoot);
|
Directory.SetCurrentDirectory(pathToContentRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var builder = CreateWebHostBuilder(
|
||||||
|
args.Where(arg => arg != "--console").ToArray());
|
||||||
|
|
||||||
var host = builder.Build();
|
var host = builder.Build();
|
||||||
|
|
||||||
if (isService)
|
if (isService)
|
||||||
|
|
Loading…
Reference in New Issue