查看代码更改而无需重新启动服务器 [英] View code changes without restarting the server

查看:81
本文介绍了查看代码更改而无需重新启动服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在如下使用Visual Studio Code和DNX.

We're using Visual Studio Code and DNX as follows.

启动Web服务器的命令行

Command Line to Start Web Server

dnx . web

project.json>命令

project.json > commands

"web": "Microsoft.AspNet.Hosting 
       --server Microsoft.AspNet.Server.WebListener 
       --server.urls http://localhost:5001"

请注意,为了便于阅读,我们添加了回车符.

Note that we added carriage returns for readability.

当我们更改*.cshtml并刷新浏览器时,更改将显示在浏览器中.很好

When we change a *.cshtml and refresh the browser, the changes show up in the browser. This is good.

当我们更改*.cs并刷新浏览器时,所做的更改不会显示在浏览器中.我们期望他们会.要查看更改,我们需要停止Web服务器(在命令行中使用Ctrl + C),然后使用dnx . web重新启动它.

When we change a *.cs and refresh the browser, the changes do not show up in the browser. We expected that they would. To see the changes, we need to stop the web server (with Ctrl + C in the command line) and then start it again with dnx . web.

这不是世界末日;而是世界末日.就是说,我认为ASP.NET 5的功能之一是无需重新编译等即可刷新的功能.

This isn't the end of the world; that said, I thought one of the features of ASP.NET 5 was the ability to refresh without recompiling etc.

我们如何更改*.cs代码并刷新浏览器以查看更改,而不必重新启动DNX Web服务器?

How can we change *.cs code and refresh the browser to see the changes without having to restart the DNX web server?

我们尝试运行dnx --watch . web的问题是,如果更改*.cs文件,则Web服务器将停止,并且无论如何都必须重新启动它.

We have tried running dnx --watch . web with the problem that, if we change a *.cs file, then the web server stops and we must restart it anyway.

推荐答案

这是预期的行为.您可以使用类似 gulp-aspnet-k 之类的方法来自动执行此过程.此处提供更多详细信息:建筑和使用Gulp运行ASP.NET vNext应用程序.

This is the expected behavior. You can use something like gulp-aspnet-k to automate this process. More detailed info available here: Building and Running Your ASP.NET vNext Application with Gulp.

请注意,不幸的是,这种gulp集成仅适用于Windows ,但是它所做的就是观看dnx进程并再次重新启动.

Note that this gulp integration unfortunately only works on Windows now but all it does is to watch the dnx process and restart it again.

这篇关于查看代码更改而无需重新启动服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆