ServiceStack:自托管 LiveReload 不起作用 [英] ServiceStack: Self-Host LiveReload not working
问题描述
我有一个自托管的 ServiceStack 应用程序,我打算用它来开发 Angular 应用程序.
I have a self hosted ServiceStack application which I intend to use to develop an angular application with.
问题是,以前,每次我对静态文件进行更改时,我都必须重新启动所有服务才能使更改生效.
The problem is, previously, every time I've made a change to a static file, I've had to restart all the services for it to pick up the changes.
我想知道我是否遗漏了什么?我已经从 RazorFormat
启用了 LiveReload
选项,但它似乎没有做任何事情?我仍然需要重新启动整个应用程序才能接收更改?
I'm wondering if I'm missing something? I've enabled the LiveReload
option from RazorFormat
but it doesnt seem to have done anything? I still have to restart the whole application for it to pick up changes?
我在这里创建了一个小副本:https://github.com/CallumVass/ServiceStackSelfHost
I've created a small repro here: https://github.com/CallumVass/ServiceStackSelfHost
如果我对 Default.cshtml
文件进行了更改,那么在我重新启动服务之前,这些更改不会被接受?
If I make changes to the Default.cshtml
file the changes arent picked up until I restart the service?
推荐答案
问题是他正在更改源文件而不是输出文件.由于 SS 将文件复制到 /bin/debug
,他需要更改该版本.
The issue is that he was changing the source file and not the output file. Since SS copies the files to /bin/debug
he needed to change that version.
使用 HostConfig 设置,我们能够在开发过程中以下列方式使用 WebHostPhysicalPath
属性,同时设置 SS 配置:
Using HostConfig settings, we were able to to use the WebHostPhysicalPath
property in the following way during development, while setting up the SS Config:
SetConfig(new HostConfig {
#if DEBUG
DebugMode = true,
WebHostPhysicalPath = Path.GetFullPath(Path.Combine("~".MapServerPath(), "..", "..")),
#endif
});
这将我们带出 /bin/debug
并回到源代码.
This took us out of /bin/debug
and back to the source.
这篇关于ServiceStack:自托管 LiveReload 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!