Comments (9)
@davidfowl We said to move this bug to here, but does it actually make sense? Can hosting actually do it?
from hosting.
In case useful to anyone on Mac OS X ( as a temporary stop-gap ), I've created the following scripts which implement file system watching for the sample HelloMVC project, as listed below. This is used in conjunction w/ LiveReload for non-compiled file changes. To start the script, run ./watch.sh from the Terminal ( scripts copied to root of HelloMVC example ):
#/!bin/sh
# watch.sh - FS watcher for ASP.NET vNext on Mac OS X
# .. Used in conjunction with ./auto-restart.sh
# .. To use run ./watch.sh from the Terminal
# Startup
pkill -f kestrel
pkill -15 screen
screen -S vnext -d -m
screen -S vnext -p 0 -X stuff $'k kestrel\n'
# Start file system watch ..
fswatch -o ./Controllers ./Models | xargs -n1 ./auto-restart.sh
#/!bin/sh
# auto-restart.sh - Restart component for ASP.NET vNext on Mac OS X
# .. Used in conjunction with ./watch.sh
# screen -S vnext -p 0 -X stuff $'pkill -f kestrel\n'
screen -S vnext -p 0 -X stuff $'q\n'
while [ 1 ]
do
pid=`ps -ef | grep "kestrel" | grep -v grep | awk ' {print $2}'`
if [ "$pid" = "" ]
then
screen -S vnext -p 0 -X stuff $'k kestrel\n'
exit
fi
sleep 0.05
done
You may wish to sudo chmod +x watch.sh; sudo chmod +x auto-restart.sh before running. There is a slight pause / down-time incurred while the web server restarts itself. "brew install fswatch" was run to install fswatch. Additional code paths must be added to the "fswatch" line in watch.sh.
Above scripts are not affiliated w/ ASP.NET vNext and aren't officially supported of course - Rather, thought they might be of interest to at least one individual.
I'm sure a more elegant and streamlined solution is in the works.
from hosting.
@glennc is this still a problem? I think we do restart the process when we pass in a --watch
switch while starting the dnx process right?
from hosting.
I'm testing this on Windows and --watch
just kills the process without restarting it.
By looking at the code here, it doesn't restart.
from hosting.
I am seeing the same on Windows and Mac.
from hosting.
@davidfowl? I recall that this is intended. --watch looks for file changes and kills the process, but it relies on another process to monitor it and re-start it. IIS does this for us, and I think VS does also.
from hosting.
If you're thinking of leaving it as-is, then the current setup will continue to be relatively substandard for those not using IIS compared to alternate technologies. In Node.js when using grunt / gulp, for example, FS watchers and automatic restarts of web servers are common place and super convenient. I recommend modernizing the toolchain for those who don't use IIS to support this and potentially offer a different switch / default behavior depending on settings and/or environment.
from hosting.
I don't recall the discussion around having another process doing the restart for you - this is for sure not the case for cross plat. @lodejard @davidfowl any suggestions here? I'm leaning towards doing the restart here.
from hosting.
Going back to aspnet/dnx#1795 as the primary discussion thread.
from hosting.
Related Issues (20)
- reading from appsettings in Program.cs using getsetting HOT 5
- IHostedService won't start automatically on IIS even if preload enabled HOT 1
- Unable to activate more than two IhostedService background services HOT 4
- Question on Generic Host logging setup HOT 4
- Roadmap: Apache/NGINX InProc hosting HOT 3
- Make BackgroundService _executingTask protected HOT 2
- Setting ApplicationKey (name) causes a different assembly to be loaded. HOT 10
- Certificate for hosting in Windows Service HOT 1
- Include URL in request finished log message HOT 2
- HostBuilder and headed UWP app on IoT core HOT 4
- Allow hosting startup failures to be detected somehow HOT 2
- can't stop in Task manager HOT 5
- Add TestHost support for ConfigureWebHost
- HostingService not receiving HttpClient through DI HOT 4
- Multiple IServer implementations in the same app HOT 4
- TestServer hangs when an exception is thrown on response starting for big responses
- launchBrowser blocks Visual Studio UI thread HOT 2
- Microsoft.AspNetCore.Hosting.WindowsServices RunAsServiceAsync HOT 1
- ionLifetime
- fixture
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hosting.