2015-07-01 33 views
2

我正在查看ASP.NET 5功能。我想知道AppDomain和AppPool如何适用于ASP.NET 5.在早期版本中,理想情况下,如果web.config或bin文件夹中有更改,AppDomain将重新启动。但在.NET 5中,在部署我们的应用程序时,web.config和bin文件夹都不存在。此外,它可以托管在IIS之外(通过像k-web这样的命令)。ASP .NET 5应用程序部署

因此,如果我们在IIS或任何其他Web服务器上部署我们的.NET 5应用程序,它涉及的过程是什么。如何在部署到IIS时重新启动AppDomain。

回答

1

如果您使用IIS(很有可能)并且想要使用system.webServer部分来配置IIS,则web.config文件仍然存在。如果您正在使用Azure并且希望在ASP.NET 5文档中看到如here所示的完整错误详细信息,那么也需要这样做。

其次,您仍然可以通过选中属性窗口中的'生成输出生成'复选框来将您的项目生成到DLL中。这可以通过包括下面的代码预编译的意见相结合(这仅处于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以外的主机,则您是独立的。

+1

这个问题并不是专门针对预编译的Razor,但这个答案是我在主题上找到的大部分信息。 从Beta 8开始,RazorPreCompilation类包含在模板中,但在/Compiler/PreProcess/RazorPreCompilation.cs中注释掉了。另外,在Startup ConfigureServices中,可能需要在“services.AddMvc()”后面添加“.AddPrecompiledRazorViews(GetType()。GetTypeInfo()。Assembly)”。 有关使用预编译的Razor视图的项目示例,请参阅https://github.com/aspnet/Mvc/tree/2e32ffc004be74a0a13057349641141239a610ea/test/WebSites/PrecompilationWebSite – Jeremy

+0

不错的@James,该示例应用似乎是唯一的地方引用'AddPrecompiledRazorViews'。可能只需要在Web项目本身之外的其他程序集中引用预编译的视图,但我不确定。这可能值得问一个关于asp.net GitHub问题的问题。 –

+0

我已经在GitHub上提出了这个问题[https://github.com/aspnet/Mvc/issues/3369]。 –