I’ve got a self-hosted razor windows service that works fine when compiled in debug mode and run in console, but when compiled as release and started as a service I get this error on my default razor page:
The application relative virtual path ‘~/Content/bootstrap.min.css’ cannot be made absolute, because the path to the application is not known.
at System.Web.VirtualPath.get_VirtualPathString() at ASP.Views.Shared.Layout.Execute() at ServiceStack.Razor.ViewPage.WriteTo(StreamWriter writer) at ServiceStack.Razor.Managers.RazorPageResolver.ExecuteRazorPageWithLayout(RazorPage razorPage, IRequest httpReq, IResponse httpRes, Object model, IRazorView pageInstance, Func1 layout) at ServiceStack.Razor.Managers.RazorPageResolver.ExecuteRazorPageWithLayout(RazorPage razorPage, IRequest httpReq, IResponse httpRes, Object model, IRazorView pageInstance, Func1 layout) at ServiceStack.Razor.Managers.RazorPageResolver.ExecuteRazorPage(IRequest httpReq, IResponse httpRes, Object model, RazorPage razorPage) at ServiceStack.Razor.RazorHandler.ProcessRequest(IRequest httpReq, IResponse httpRes, String operationName) at ServiceStack.Host.Handlers.HttpAsyncTaskHandler.<>c__DisplayClass9_0.b__0() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.Execute()
I’ve tried adding this to hostconfig (with and without) with no effect:
var config = new HostConfig
{
WebHostPhysicalPath = "~".MapServerPath()
};
Any ideas?