Can ASP.NET vNext with .NET core be hosted outside of IIS? - apache

For Mono, it is explicit that ASP.NET can be hosted outside IIS on Apache or Nginx
Since the 1.0.0 release is nearby, I was looking at the publishing aspects of open source ASP.NET vNext.
Can ASP.NET vNext be hosted outside of IIS on a *nix server such as Ubuntu?

Yes, ASP.NET Core can be hosted at linux.
Have you tried this documentation, in which helps to install in Ubuntu 14.04?

AspNet Core has its own web server called Kestrel. Anytime you run an Asp.Net Core web app you run it using this server. IIS or Nginx are used as reverse proxies you can use when you want to expose your app in the wild (they can handle authentication etc.). During development you can just Kestrel directly without have to set up IIS or Nginx.

I dont know if it is working with Nginx, but Apache Server has a module called mod_asp which is a bridging component to the .NET runtime. Maybe that one is worth a try.

Related

Web.Config file in ASP.NET Core

Do configurations specified in web.config in ASP.NET core apply only to IIS Server or it applies to all non IIS servers?
So far it seems the web config is just for the IIS. Standalone hostings with kestrel would not use it.
The web.config will only be used for IIS. It is used to tell IIS to use aspnetcore module and enable some specific setting when host the asp.net core application on IIS.
If you want to host asp.net core application on another server, the asp.net core application will use kestrel.
If you want to modify the kestrel setting, you could use appsetting.json.
More details, you could refer to this article.

Simple hosting of a .NET Core Web API Service (Similar to NodeJs)

I have a .Net Nuget Package that works on a .NET Core Web API Service when it is proxied by my API Management Server. I would like to setup some automated testing of this service to be run when I run my builds.
Normally, when I want to run a service to be seen from other computers, I host it in IIS. But I would rather not have to have IIS up and running on my build servers.
I am wondering, is there a simple way to host a .Net Core Web API Service that can just run in-memory? (Similar to the way NodeJs can be run) I understand that Kestrel is used under the hood for ASP.NET Core. Maybe it be setup to do that?
NOTE: Because this will be proxied by my API Management Server, it need to be accessible by other servers on my network. (Not just localhost.)
Kestrel is the simplest way you can use to achieve, you can config kestrel to enable it listening to remote request, see this document

WebHost.CreateDefaultBuilder when hosting without IIS on Windows

I'm planning to host Asp.Net Core 2 application without IIS on Windows.
The default way to create web host seems to be using WebHost.CreateDefaultBuilder. But what is confusing me is that inside there is a call to the method UseIISIntegration.
Is it ok to use WebHost.CreateDefaultBuilder when hosting Asp.Net Core 2 app without IIS on Windows? Or other options are advisable?
Its absolutely fine to use WebHost.CreateDefaultBuilder
As when hosting with IIS it just work as proxy and redirect request to kestrel server.
It doesn't create much of problem.
Take a look at this article here

.NET Core Hosting Bundle

As far as I understood the Docs, the .NET Core Hosting Bundle installs the .NET Core Runtime, .NET Core Library and the ASP.NET Core Module.
It seems that there's a Bundle for every version of the .NET Core Runtime (2.0.6, 2.0.7, ...).
If I have a self contained deployment of my app, I still need the ASP.NET Core Module. However I don't see that the Module can be downloaded separately without the full bundle. Is there a place where I can download it ?
If not:
What's the point of having a self contained application, if I still need to install the whole .net core sdk/runtime bundle on my IIS Server?
There is no official download of the ASP.NET Core Module for IIS ("ANCM"), though it can be installed by calling the hosting bundle installer with OPT_INSTALL_LTS_REDIST=0 OPT_INSTALL_FTS_REDIST=0 as arguments (at least for 1.0-2.0 installs).
What's the point of having a self contained application, if I still
need to install the whole .net core sdk/runtime bundle on my IIS
Server?
Apart from the installer being able to install only ANCM, do not forget that IIS is not the only hosting option for ASP.NET Core Applications. People may still opt to host it on linux or as a Windows Service. Either being exposed to the public Internet (which is supported from 2.0+) or behind NGINX/Apache/…
It is also very useful to deploy preview, daily or custom builds of any component inside .NET Core / ASP.NET Core if needed.
Check the docs on this topic.
The ASP.NET Core Module is a fork of HttpPlatformHandler which was modified to work with ASP.NET Core's new system and was previously used to host ASP.NET Applications. related GitHub issue
IIS needs it in order to start up your ASP.NET Core application when the first request arrives and to route requests to the ASP.NET Core application.
With .NET Core (and hence ASP.NET Core), ASP.NET Core comes with its own http server (previously this was only possible with Http.sys aka WebListener self-hosting, i.e. commonly used for WCF services). It also redirects a couple of headers to the application, since IIS with ASP.NET Core only acts as reverse proxy.
In other words, ASP.NET Core is hosted outside the IIS process, and ASP.NET Core Module is there to communicate with it and starts the outside process if not already. This also means, that ASP.NET Core applications hosted in IIS are subject to IIS lifetime cycle (i.e. IIS may and will stop your applications when idle - This doesn't happen when you self-host your application or use something like nginx as reverse proxy).
With ASP.NET Core 2.1 preview1 it will also be possible to host ASP.NET Core application in the IIS process (w3wp.exe) for a improve request throughput. For more information on this, read ASP.NET Core 2.1.0-preview1: Improvements to IIS hosting

Why publishing to IIS is change for ASP.net core ?

When I publish under Visual Studio 2015 CTP 5 then I don't have to do setting for application pool CLR version.
Now for ASP.net core application and as per documentation (http://docs.asp.net/en/latest/publishing/iis.html) we have to do setting for application pool clr to No managed code.
Why it is like that ?
ASP.NET Core applications no longer run inside IIS but run out-of-process and IIS acts only as a reverse proxy. This functionality is provided by the AspNetCoreModule which is a native IIS module. Since no managed code runs in the IIS process it is recommended to set application pool as "No managed code".
I wrote a detailed blog post describing how ASP.NET Core applications are running with IIS. You can find it here.
This is because ASP.NET Core runs as a plain old command line application outside of the IIS. Therefore, IIS is merely a pass-through to Kestrel, which is the ASP.NET Core web server which runs in it's own separate process. This platform is what provides the cross-platform capabilities of .NET Core.