aspnet / HttpSysServer

[Archived] A web server for ASP.NET Core based on the Windows Http Server API. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
106 stars 39 forks source link

Add Hosting as a depenency #125

Closed davidfowl closed 9 years ago

davidfowl commented 9 years ago

Because it's nice having the server bring it in so users don't have to do it. It was originally removed because of layering but makes it a pain for people to figure out.

DamianEdwards commented 9 years ago

Yep. Right now, if you create an empty project then remove the IIS (Helios) dependency, it fails to build because the ref to hosting disappears.

Tratcher commented 9 years ago

How about adding Hosting to the template instead?

Otherwise we should also re-merge Microsoft.AspNet.Hosting.Server.Abstractions back into Hosting as it will be redundant.

rynowak commented 9 years ago

I ran into this recently and it was kinda annoying. I don't expect a new developer to the stack to easily figure it out from the error message either. It's nice to just be able to specify the server you want and have something working.

Tratcher commented 9 years ago

It's nice to just be able to specify the server you want and have something working.

This makes me wonder if our current entry point is not a natural fit for developer expectations. If developers want to select a server and run it, why do they need to explicitly use Hosting to do so? Why not just run the server directly?

Here's the commands in their current form:

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

https://github.com/aspnet/Home/blob/dev/samples/latest/HelloWeb/project.json#L20-L23

Consider cutting out the middleman:

"web": "Microsoft.AspNet.Server.WebListener --urls http://localhost:5001",
"kestrel": "Kestrel --urls http://localhost:5004"

Kestrel already has something like this: https://github.com/aspnet/KestrelHttpServer/blob/dev/src/Kestrel/Program.cs#L15-L20

We may also consider re-working the internals around IServerFactory discovery and execution to better align with this mental model of the server as an entry point. That may make Helios and TestHost's use of IServerFactory less awkward as well.