10

Currently I'm trying to find a way to build a desktop app that hosts a browser window and uses JavaScript to communicate with a local ASP.NET Core Web API as the "backend":

enter image description here

All my searches lead to the suggestion that I should use IIS Express web server.

Unfortunately, IIS Express does not fit into my scenario, since I want the whole application to be installable and runnable by non-admin users.

Since IIS Express requires administrative permissions to install, this is out-of-scope to me.

My question:

Is there another way beside using IIS Express to run an ASP.NET Core Web API project?

I've read about the Kestrel server which seems to be what I am looking for, but I still don't get the big picture here.

Edit 1:

I've asked a somewhat releated question over at SE Software Recommendations.

Community
  • 1
  • 1
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • 1
    Kestrel will work well here, have you tried? – DavidG Aug 11 '16 at 21:58
  • Thanks, @DavidG — I'm still trying to understand what Kestrel _really_ is. Am I right that it ships as part of .NET Core? So I could simply ship my application with those MB of .NET Core files and have Kestrel included? I also fear that it is kind of a "proof-of-concept" web server that is not fast/mature enough for a real-world scenario? – Uwe Keim Aug 11 '16 at 21:59
  • 1
    Yes, that's pretty much what it is. It's also cross platform so your app will pretty much run anywhere too. – DavidG Aug 11 '16 at 22:01
  • 1
    As for whether it's POC or not, absolutely not the case. MS are fully supporting it and it now runs significantly faster than IIS, last I heard it could serve a tonne of requests per second. – DavidG Aug 11 '16 at 22:01
  • Awesome, @DavidG. How about posting this as an answer here, so I can accept it? – Uwe Keim Aug 11 '16 at 22:02

2 Answers2

6

I'm sure Kestrel will work well for you in this situation. It's a cross platform web server which is based on libuv which means it is super fast. The official benchmarks show just how much it outperforms standard IIS.

DavidG
  • 113,891
  • 12
  • 217
  • 223
  • I've did some _very_ simple comparisons between an IIS Express Web API and a Kestrel Web API. I've called both with Apache Bench (`ab.exe`). Results: IIS Express: **4013.10 [requests/sec] (mean)**, Kestrel: **4375.13 [requests/sec] (mean)**. So not _that_ much of a difference. – Uwe Keim Aug 16 '16 at 14:27
  • 1
    There's likely some other bottleneck here then. Kestrel significantly outperforms IIS and IIS Express. you may be hitting your local machine disk, CPU or network limit. Benchmarking like this is incredibly nuanced and difficult. – DavidG Aug 16 '16 at 14:32
  • 1
    Just for the records: It is also possible to use the Kestrel web server in a "normal" .NET Framework project, e.g. .NET 4.6.1. Simply add the `Microsoft.AspNetCore.Server.Kestrel`NuGet package as a reference. – Uwe Keim Aug 17 '16 at 09:16
-1

To add to DavidG's answer.

Kestral is the correct solution IFF you want to run ASP.Net without IIS.

However this requires an open TCP port to work. Meaning that if you try to bind Kestral to port 80, AND the user has IIS installed. Kestral will fail to run.

You can get around this by using Katana to bind your website to a subdirectory within IIS. Unfortunately, this will often require Admin Rights.

Overall, you can basically use any OWIN server you want.

You can even put in some code to choose which OWIN server you use, based on the circumstances.

Aron
  • 15,464
  • 3
  • 31
  • 64
  • What are the other OWIN servers you are refering to? – Uwe Keim Aug 15 '16 at 06:31
  • 3
    Kestrel is also the answer if you want to run *with* IIS. You have to set IIS up as a reverse proxy. – DavidG Aug 15 '16 at 07:45
  • I'm not sure that I'd be comfortable using that library as it hasn't been updated for 4 years and the project owner hasn't even bothered to keep the domain where it was hosted. – DavidG Aug 15 '16 at 09:10
  • @DavidG My bad, I meant Katana. The OWIN names are really confusing. I recommend using Katana when using IIS. – Aron Aug 15 '16 at 09:43
  • Well OWIN is just a spec and Katana is the MS implementation of that I also don't know why you would use Katana when Kestrel will handle the job on it's own and if you want a fully hosted solution then IIS or Nginx would be more appropriate. – DavidG Aug 15 '16 at 09:54
  • @DavidG I explained my reasoning in my answer. But in effect Katana is built on Windows Activation Service, which is effectively an API to set up IIS as a reverse proxy on a partial path in IIS. The point being is that multiple .net applications may want to host on port 80. If you only have a single application hosted on root, then yes, a libuv server is better. – Aron Aug 15 '16 at 09:58