I am trying to understand the entire web/framework/application stack when installing ASP.NET 5 on Linux.
All the instructions I have read, including this one haven't really answered my question:
Why can't Nginx server work without Kestrel like here: http://www.mono-project.com/docs/web/fastcgi/nginx/ ?
Or am I way off. I'm trying to understand what the reason is for this structure:
.NET Core(or mono) --> Kestrel --> Nginx
Isn't Kestrel just another web server like Nginx but with a lot less features?
ASP.NET Core (ASP.Net 5) doesn't require Kestrel!
You're right, Kestrel is just a simple HTTP server with a small set of features. You can run ASP.NET Core without Kestrel on Linux or Mac, but you must either have an HTTP server or a fastCGI server.
Nginx is used as a reverse proxy for static contents in general and you can also enable gzip compression on your dynamic content. Kestrel doesn't have this feature.
You can also write your own HTTP server with the specific HTTP features you need (HTTP2 for example).
Necromancing.
Yes, it does in fact require Kestrell.
As Agua says, theoretically, it could also be run on some other http-server than Kestrell, one that can run .NET Core, or via FastCGI.
However, AFAIK, Kestrell is the only http-server currently in existance that can actually do that.
And because AFAIK, a FastCGI-server/library written in .NET Core doesn't (yet) exist.
Right now, if you want to use .NET Core with nginx or Apache, all you can do is to reverse-proxy requests to kestrell.
Related
I'm working for company which we have their own Virtual server for WordPress sites and It is running.
I don't know much about servers and hosts but I know that we run apache on server for WordPress sites and use cPanel for server management.
I create an application with ASP.NET Core 3.1 and Core is a cross-platform.
My question is ...
Can I run my application on this server without conflicting with other WordPress sites?
Thanks For Your Help!!
As long as you run your ASP.NET Core server on a port which is not used by another server, you should be fine.
Mahdi, Since you are using .NET Core you can host ASP.NET Core on Linux machines with Apache. For more details take a look at this article. To see how exactly to configure Apache reverse proxy take a look here.
Also bear in mind that you can run an entire WordPress Application over an ASP.NET Core Host seamlessly using PeachPie which is an open-source PHP language compiler and runtime for .NET and .NET Core frameworks. If you are interested in this take a look here.
Simple noob question :-)
I'm about to go into production with a small .NET core app host that's hosted in a droplet at digitalocean. I've always hosted websites using IIS, but I would like to move to linux distributions and use nginx as reverse proxy.
My question is as the title says :-) Does kestrel every need to recycle a "application pool" like the IIS does? If not, does that mean the application is loaded from Kestrel is online until it's shut down?
Best regards
Jens
Based on bits of information here and there from watching all the http://live.asp.net Community Standup meetings I'd so no, Kestrel does not recycle itself the way IIS does.
The reason for this is that Kestrel currently has no way to restart itself if it stops. That's one of the many reasons why it's important to put it behind some sort of reverse proxy like IIS or nginx. This kind of process lifetime management functionality must currently come from a software layer outside of Kestrel. If Kestrel dies due to a software bug or other reason and there is no reverse proxy or other process to restart it, it will not restart by itself and the website will be stay down.
For additional information, this article talks about Publishing to a Linux Production Environment and includes an example nginx system service file that has Restart=always https://learn.microsoft.com/en-us/aspnet/core/publishing/linuxproduction
I am quite confused as I haven't seen any blogs or instructions on how to host ASP.NET Core/.NET Core applications with HA and multi-host deployments. All examples are either:
1) One NGINX reverse-proxy, one Kestrel
2) One IIS reverse-proxy, one Kestrel
And both components on same host. In real-life production environments, you have LB maybe service discovery, multiple frontends, multiple backends, etc. But for this case there are no instructions whatsoever. So my questions would be for multi-host environments:
Do I deploy one IIS/NGINX as LB/Reverse-proxy, and redirect requests to Kestrels running on many separate VM:s, i.e. various different IP:s?
Or do I run an NGINX/F5 for load-balancing on one host, then route http traffic to various VM:s that run IIS+Kestrel, or just Kestrel? Is IIS required in this setup as NGINX acts as LB?
If I run IIS or NGINX as reverse-proxy, can they keep alive Kestrels on different VM:s, or does each Kestrel require exactly one IIS/NGINX to keep it alive? I.e. the Kestrel process must be on the same same host as the reverse-proxy?
All answers are very welcome, and thanks a lot in advance! :)
I'm running NGINX at the edge as a load balancer and for SSL Termination and multiple servers with IIS + Kestrel serving MVC. This is working well for us. You may not need it but I've found NGINX to be quite a bit more sophisticated and powerful than anything you could do with IIS. Obviously F5 or something would work as well. Previously I also ran for a while using AWS ELB load balancers which also worked fine, just didn't have much configurability. So depends on your needs.
As was mentioned already, IIS is needed on each box running kestrel to manage the process. You could do this some other way, but using IIS is the easiest.
I have a setup with one VM using (IIS as LB) + several VMs with (IIS + Kestrel). It's working fine for my usage, but I'm curious to see if other people have different suggestions. Then it depends on what you are doing, if you use encryption, machine key needs to be shared between VMs, you might also needs to share session between VMs (https://www.exceptionnotfound.net/finding-and-using-asp-net-session-in-core-1-0/), store things in database ...
Now that ASP.Net Core has been released I feel it's time to ask this question.
For my web application, I need to use a WebListener server due a business requirement for self-hosting and NTLM authentication for Windows IDs. The Weblistener server needs an SSL Certificate.
I have generated a SSL certificate and know that for Kestrel it is pulled up in the code of the web server (in Program.cs or Startup.cs). But what is the equivalent way to do that for Weblistener?
I found this post: How to Use HTTPS with Microsoft.AspNet.Server.WebListener but it was never truly answered. A couple hours of Googling didn't turn up anything either for me.
From what I can tell it is some kind of command like:
netsh http add sslcert
But I am in over my head in terms of what I need to do for Weblistener specifically. If possible, I'd love to pull in the certificate using code similar to Kestrel in the startup sequence (it's so convenient!), but I am pretty sure I need to install it with the command line.
Thank you very much in advance!
As davidfowl said, the article https://weblog.west-wind.com/posts/2013/sep/23/hosting-signalr-under-sslhttps does outline the process needed and explains it well. It mentions SignalR instead of WebListener but the procedure is the same.
Upon further research if you need to go without IIS (as you might if you are using WebListener because of a business requirement to not be allowed to install IIS) Powershell is a good way to generate self-signed certificates or you can use MMC to obtain a certificate as well.
We have a desktop client application and recent customer requests indicate that they would like to have some dynamic HTML content served and displayed by the application.
We are considering hosting a simple ASP.NET application in a local process, accessible only from the local machine (similar to the ASP.NET development web server used when debugging from Visual Studio).
How can we run an ASP.NET application locally without IIS? IIS is not an option because most client machines will not have it installed.
Is there a leightweight ASP.NET web server that could run locally similar to the development web server that VS is using?
I have found some information about "Cassini". Is this suitable for production use? Can it handle ASP.NET MVC? Are there any alternatives we should consider?
I have not used it myself, but you can try the mono XPS server.
It is a stand alone webserver.
The easiest way to start XSP is to run it from within the root directory of your application. It will serve requests on port 8080. Place additional assemblies in the bin directory.
Cassini is in fact also a good option - it is the development web server that comes with visual studio (so widely distributed, used and tested) and is also used by the open source ScrewTurnWiki. See wikipedia.
In regards to your "only locally" requirement - a web server will serve any request made to the right port. In order to limit accessibility, you should use a firewall that will block any external requests.
You might consider using WCF to host a service on the local machine that can serve the data without having to host a full blown web server.
If you do this, WCF allows you to expose the service with multiple endpoints and make it available through HTTP, TCP, or Namepipes. Namepipes would restrict traffic to only the local machine.
I have also tried IIS Express. It works great with ASP.NET MVC. Right now it is available only with Web Matrix, but installing web matrix is easy.
Coming back to this question three years later, ServiceStack.NET with self-hosted option seems like a good choice. While it is not ASP.NET MVC directly, it provides a good API and features are on par with ASP.NET MVC/WebAPI (or in some ways better).