asp.net webapi core 3.1.self-hosted Kestrel app needs conversion to WIndows service - asp.net-core

Have a working self-hosted WebApi exe using Asp.Net Core 3.1 and Kestrel and http. How can I convert that to a Windows service?
It was developed using Visual Studio 2019 Community, and also includes Serilog and Swagger, but uses a third party facilty (Actian OpenROAD Server) rather than a database.
I have searched lots of articles but nothing seems to specifically address this issue. The notes on starting from scratch using a "Worker" also do not help much and are mostly aimed at running background tasks for MVC.
Sorry but I have searched recent questions under various tags and cannot find a suitable answer.

Related

Single Sign On from MVC 4 to .Net Core application

We are trying to implement single sign on, across multiple domains from MVC 4 application to .Net Core application.
MVC 4 to MVC 4 it's working fine with MachinKey, but not with .Net core.
How can we implement SSO to share the same authentication with all other application in MVC4 and .Net core application.
Identity Server can do this. Identity Server version 4 will be supported and free for as long as .NET Core 3.1 is supported. After that, you'll need Duende Identity Server, which is the next version, available on a commercial licence.
You can also do it with OpenID Connect (AKA OpenIddict) which is free for the foreseeable future, but that will probably need you to write a bit more code.
I have used both.
Both of them are agnostic to the type of client applications, so your clients can be MVC4, .NET Core, Xamarin, React, anything at all. Both of them have good templates that you can download and get started quite quickly with a simple scenario.
Unfortunately, in my experience, making meaningful extensions or changes to the templates (such as what you're proposing) was difficult and required in-depth knowledge of internet security concepts, studying the documentation and source code of whichever library that you choose.
I have tried really hard to learn but I still find it difficult, so I wish you good luck!
Here are the sample projects for IdentityServer4:
https://github.com/IdentityServer/IdentityServer4.Templates
And here is the documentation on how to get started:
http://docs.identityserver.io/en/latest/
Here are the sample projects for Open Id Connect:
https://github.com/openiddict/openiddict-samples
And here is the documentation:
https://openid.net/connect/

Was Kestrel present in .NET Framework?

Was Kestrel present in .NET Framework or was it developed specifically for the ASP.NET Core?
I was not able to find an answer to this question by just googling, so I decided to ask it here. I need it because I am intended to work with the ASP.NET Core and would like to know the history of development better, because knowing it allows to better understand the decisions made by developers.
In order to give an official answer to this question, I copy here comments from #AnkushJain and #andrew-morton:
Kestrel is not available for .NET Framework. It is born with the origin of ASP.NET Core.
[In addition] since Kestrel is not a fully-featured web server, you should run it behind IIS or NGINX. It was designed to make ASP.NET as fast as possible but is limited in its ability to manage security and serve static files.

Access Service Fabric cluster via .net standard with web api

I have a service fabric stateless service which I am running inside my cluster within azure
At the moment the service in question only has 1 instance
I would like to be able to access data in the service via web api
How can I do this with .net standard not .net core?
There are a lot of links for creating web apis but they seem to be either Old or they refer to .net core
Some also give instructions for adding via visual studio which now doesn’t appear to be available within visual studio 2017
Paul
ASP.Net Core is only compatible with .Net Framework and .Net Core. Not .Net Standard unfortunately.
ASP.NET Core is a new open-source and cross-platform framework for
building modern cloud based internet connected applications, such as
web apps, IoT apps and mobile backends. ASP.NET Core apps can run on
.NET Core or on the full .NET Framework. It was architected to provide
an optimized development framework for apps that are deployed to the
cloud or run on-premises. It consists of modular components with
minimal overhead, so you retain flexibility while constructing your
solutions. You can develop and run your ASP.NET Core apps
cross-platform on Windows, Mac and Linux. Learn more about ASP.NET
Core.
https://github.com/aspnet/Home

How to enable trace.axd in ASP.NET core?

Our app is based on ASP.NET Core 2.0. It works fine in development environment but we see an oauth error when published to production.
All the documentation on asp.net core seems to point to using ILoggingxxx interfaces. The examples I found typically call logging.AddConsole() method so that the log lines can be viewed in VIsual Studio debug window. I am wondering if the good old trace.axd is still available under asp.net core. If so, I would appreciate the steps to enable tracing. Regards.
trace.axd is exclusive to applications based on .NET Framework and ASP.NET 4.x. It is not available in ASP.NET Core applications at all.

What framework should I choose to build a WCF Restful API

I am wanting to build a Restful API using WCF however I am struggling to make a decision on how to accomplish this.
The WCF Rest Starter Kit was developed for .Net 3.5 and has not progressed past Preview 2. Although it can be used within the current .NET Framework and within Visual Studio 2010 it seems from my research to be dead in the water and superseded by the new WCF Web API which is currently in Preview 5.
On the other hand the WCF Web API is only at preview stage and should not really be used in a production application as many things could possibly change before its release. There is also no indication if its nearing completion and if it’s going to be in the next .NET Framework release and when that is intended to be.
I find myself between rock and a hard place and look to the wider community to provide me with some guidance on this if at all possible.
You should regard this tweet from Glenn Block.
Using ASP.NET MVC for building a Restful API should be straight forward and easy way to do it.
However I've used WCF Web Api with WCF Rest Contrib in production without any problems.
See
Creating REST API with ASP.NET MVC that can speak both JSON and Plain Xml
RESTful Services With ASP.NET MVC
ASP.NET MVC – Create easy REST API with JSON and XML
Maybe OpenRasta is what you are looking for?
See also
RESTful framework alternatives to WCF
I depends on your application. If its a Website (also has views) that offers the REST API using ASP.NET MVC would be less technology, less effort, less know-how etc.
If its JUST an REST API choose what you like more from development style: ASP.NET MVC or WCF Web API