解决方法
您可以启用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中添加Browser Link NuGet包:
"dependencies": { "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta7",// Omitted... }