Web.Config file in ASP.NET Core - 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.

Related

kestrel in asp.net core

let's say you have multiple applications on a server. Is there is 1 kestrel instance handling multiple applications request or will there different kestrel instances handling different asp.net core web applications?
Can anybody provide me any links or a post where i can find out how a request travels from the client to server for ASP.NET core applications. see this SO post without an answer. The Relationship of Kestrel server and Program.cs in ASP.NET Core request processing
Kestrel is a cross-platform web server for ASP.NET Core. Kestrel is the web server that's included and enabled by default in ASP.NET Core project templates. For the http request process, you could check this article:
So, from the above document, we can see that each Asp.net core application will have their own Kestrel server to host the application. And, by default when using Kestrel, ASP.NET Core binds to: http://localhost:5000 and https://localhost:5001, if there have multiple applications, you should set them use different port or endpoint. Reference: Configure endpoints for the ASP.NET Core Kestrel web server.

.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

ASP.NET Core Application Initialization on Azure

I'm trying to implement Application Initialization (warm up) on an ASP.NET Core web app running on Azure, as described for IIS 8.
The way it's described is changing web.confg to enable and configure it.
But in asp.net core we (almost) don't have web.config.
So, how do we configure Application Initialization (or any other feature that require
changing web.config)?
I finally figured out, for this question and any other that requires IIS to be configured through web.config:
It's not true there isn't web.config anymore. It's true that it doesn't play any role in the asp.net core app, but you can find a small web.config file in wwwroot project folder, which is what tells IIS how to handle the asp.net core app.
So for implementing this, or for example urlrewrite, you just need to add IIS configuration to that web.config file as it's being deployed as part of the application.

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

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.

Can I host a wcf 4.0 website in IIS instead of as an application in IIS?

Most examples I see about hosting WCF in IIS have you create an Application under an existing website. I have a website in IIS, but the website uses a .NET 2.0 app pool, so I can't host the service as an application under the website. Is it better to create an empty website to just host the service or to create an empty website and then create an application under that empty website to host the service?
I have WCF running as a WebSite in both IIS6 and IIS7, and they work fine. They basically work exactly the same as any ASP.NET site; the .svc files are conceptually similar to .aspx pages, in that IIS calls over to .NET to process them, and all the core WCF stuff is in the assemblies in \bin. The web site is assigned to an App Pool where the actual processes run, just like a normal ASP.NET site. I don't think you need to make an 'Application' in IIS.
You don't need a new website - you can still host WCF in a 2.0 application pool - but in your project you'll need to set the target framework version to 3.5, instead of 4.0.