c# - ASP.NET Core Running as Windows Service gets 500 Internal Server Error -
i'm trying implement asp.net core application windows service. i'm following steps outlined here. publish app, create service pointing executable in publish location. service gets created successfully. start service , successful. however, when try navigate browser url set up, "500 - internal server error". i'm pretty new process , don't know how track down. here how set entry point:
public static void main(string[] args) { var isdebug = debugger.isattached || args.contains("--debug"); string runpath = isdebug ? directory.getcurrentdirectory() : path.getdirectoryname(process.getcurrentprocess().mainmodule.filename); var host = new webhostbuilder() .usekestrel() .usecontentroot(runpath) .usewebroot(path.combine(runpath, "wwwroot")) .useurls(new string[] { "http://myserver:9191" }) .useiisintegration() .usestartup<startup>() .build(); if (isdebug) { host.run(); } else { host.runasservice(); } }
fyi, i've tried , without usewebroot line, , i've tried usewebroot both relative , absolute path. can point me in right direction? more info needed?
thanks! dennis
thanks help, commenters! turns out had not added views structure publishoptions in project.json. section looks this:
"publishoptions": { "include": [ "wwwroot", "web.config", "**/*.cshtml", "appsettings.json" ]}
everything seems work now!
Comments
Post a Comment