asp.net - 使用 Asp.Net 5 实时重新加载

标签 asp.net visual-studio-2015 asp.net-core asp.net-core-mvc livereload

在 Asp.Net 5 中,开发速度更快,因为它在保存时进行编译。 但我还是得手动刷新浏览器。

Visual Studio 中是否有实时重新加载选项,或者我应该使用 gulp 插件吗?

最佳答案

您可以启用 BrowserLink,并在编辑代码时按 Ctrl+Alt+Enter 以使浏览器自动刷新。或者,您可以点击 Visual Studio 工具栏中的浏览器链接刷新按钮。

public void Configure(IApplicationBuilder application)
{
    // Only enable browser link if IHostingEnvironment says it's 
    // running in Development.
    if (this.hostingEnvironment.IsDevelopment())
    {
        // Allow updates to your files in Visual Studio to be shown in 
        // the browser. You can use the Refresh 
        // browser link button in the Visual Studio toolbar or Ctrl+Alt+Enter
        // to refresh the browser.

        application.UseBrowserLink();
    }
    // Omitted...
}

您还需要在 project.json 中添加浏览器链接 NuGet 包:

"dependencies": {
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta7",
    // Omitted...
}

关于asp.net - 使用 Asp.Net 5 实时重新加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33034169/

相关文章:

asp.net-core - Asp.net Core 模型绑定(bind)器接受 bool 类型的随机整数

ASP.NET 核心 2 : Model bound complex types must not be abstract or value types and must have a parameterless constructor

c# - AsyncPostBackTrigger 仍然每隔一段时间刷新整个页面

asp.net - 尝试从 ASP.NET 调用外部 Web 服务返回 401 - DefaultCredentials 为空

c# - ASP.Net 5 AuthorizationHandler 失败重定向

c - wdk 8.1 kmdf驱动蓝屏

session - AddDistributedSqlServerCache 没有将 session 保存到数据库中

c# - 页面加载完成后,如何使用 ABCpdf 中的 AddImageUrl 生成 pdf

windows - 已安装 VS 2015 后如何安装 WinDbg?

visual-studio-2015 - .Net Core project.json多个同名​​项目