我正在查看 ASP.NET 5 功能。我想知道 AppDomain 和 AppPool 如何适应 ASP.NET 5。在早期版本中,理想情况下,如果 web.config 或 bin 文件夹发生变化,AppDomain 将重新启动。但是在 .NET 5 中,在部署我们的应用程序时,web.config 和 bin 文件夹都不存在。此外,它可以托管在 IIS 之外(通过 k-web 等命令)。
因此,如果我们在 IIS 或任何其他 Web 服务器中部署我们的 .NET 5 应用程序,其中涉及的过程是什么?部署到 IIS 时 AppDomain 是如何重启的?
最佳答案
如果您正在使用 IIS(很有可能)并且想要使用 system.webServer 部分来配置 IIS,则 web.config 文件仍然存在。如果您使用的是 Azure 并希望查看完整的错误详细信息,这也是必需的 here在 ASP.NET 5 文档中。
其次,您仍然可以通过选中属性窗口中的“生成时生成输出”复选框来将项目生成到 DLL 中。这可以通过包含以下代码与预编译您的 View 相结合(这仅适用于 Beta 7):
/// <summary>
/// Enable pre-compilation of Razor views, so that errors in your .cshtml files are caught and displayed
/// in the Visual Studio errors window at compile time, rather than your sites users receiving a runtime 500
/// internal server error. Pre-compilation may reduce the time it takes to build and launch your project but will
/// cause the build time to increase. It will also stop edit and continue working for .cshtml files.
/// </summary>
public class RazorPreCompilation : RazorPreCompileModule
{
public RazorPreCompilation(IServiceProvider provider) : base(provider)
{
this.GenerateSymbols = true;
}
}
我相信基于文件更改的应用程序域重启是 IIS 的一项功能,而不是应用程序本身的一项功能,我相信这将继续有效。如果您使用的是 IIS 以外的主机,那么您就得靠自己了。
关于c# - ASP .NET 5 应用程序部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31156081/