Where to host a proxy app with YARP to migrate from .NET Framework to .NET Core? - asp.net

We have a big ASP.NET Framework application hosted in IIS and we are considering a progressive migration to ASP.NET Core using YARP, as explained here: https://devblogs.microsoft.com/dotnet/incremental-asp-net-to-asp-net-core-migration/
The basic idea is to deploy a ASP.NET Core app that will proxy all the requests to the old application, and then move the code progressively from the legacy app to the proxy, until the legacy app is empty and can be removed.
We are wondering about the hosting of the ASP.NET Core proxy app. In priciple there is no limitation, it could be deployed in IIS alongside with the legacy app or be deployed with Docker/Kubernetes. However, we don't know if that second option will cause a performance penalty or any other kind of problem. So before doing a POC, we'd like to ask if somebody has experience with this problem and some advice about it.

Related

Sharepoint Provider Hosted Add In using .Net Core application

I am currently attempting to take an application that I have already created as a .Net CORE Application and connect it to Sharepoint Online in the form of a Provider Hosted Sharepoint Add In.
It seems that Sharepoint add ins can only recognise .Net Framework web applications which would result in having to port the .Net CORE application to a .Net Application.
I am seeking the easiest and cleanest way to proceed with this.
Is there a way that I can create a Provider Hosted app using .Net core or should I port the .NET Core application to a .Net Framework web application?
If so, how would you go about doing this?
Even we were trying to achieve the same thing. But we ended up in .net framework. To be on the safer side, you can create a provider hosted app using visual studio, which gives better connectivity to the Sharepoint App.
.Net core to .Net framework conversion would be so simple, since the framework holds most of the libraries and functionalities when compared to .Net core. You can just copy paste the code from your.net core and you can do modifications to fit in the framework.
Otherwise, you can use oauth tokens by using SharePoint Rest API's. If you have already built the provider hosted app and installed it in your site collection, you can just use the existing client id, client secret to get the access token like this. So that you can perform everything using your existing .Net core app.

ASP.NET Core Web API living inside a ASP.NET 4 IIS Web Site

I am tasked to to build a Web API application. The app will be hosted inside an existing web site - a pre-ASP.NET 5 web application with a WCF web service.
I wonder - can I build the web-api application using ASP.NET Core 1 in a way that it can happily exists as a sub application inside the already existing site in IIS?
Thanks!
Yes, this is possible, I'm doing the opposite of this scenario but conceptually its the same thing. You need to create your subsite as a separate application in IIS with its own app pool. That app pool needs to be configured No Managed Code per the instructions on the Docs site https://docs.asp.net/en/latest/publishing/iis.html
The only other thing you need to watch out for is that the web.config in the subsite will inherit some settings from the root web.config, so you need to remove or clear things sometimes like handlers, modules, etc.
If I understand you correctly it is not possible what you want. Please refer to the following documentation about hosting ASP.NET Core on IIS: https://docs.asp.net/en/latest/publishing/iis.html.
If you specifically look at the .NET CLR version in the application pool it should be "No Managed Code" while your current website is set to a .NET framework version I assume. This is because ASP.NET Core is now cross plaform and completely web server agnostic. It even needs a little 'trick' (the ASP.NET Core Module) to work on IIS. See: "The module creates the reverse-proxy between IIS and the Kestrel server."
But if you follow the link provided above I think you'll manage to work it out.

Web.Api 2 and Asp.Net core in one solution

Currently we use ASP.NET core project for our UI. There is need to add an OData service to it. As far as I understand it is not supported well enough yet, so it was decided to implement it in a separate Web.Api 2 project.
Is there someone who has such an experience?
Is it a way to go?
May I encounter troubles with deployment to Azure?
Any ideas and thoughts would be appreciated.
If you hosted the web site on a different web application, then you have to enable CORS on the web API, and you have to test it during development to avoid any issues.
You can overcome this issue by deploying both the UI and API to the same Azure Web App. you can have the UI under the root and the API under a virtual directory, ex: apis

Distinction between Kestrel and Katana

My understanding is currently you can self host WebAPI using Katana, and MVC will have this capability in a future version. Essentially Katana will be a hosting option available to both MVC and WebAPI.
Kestrel has entered the picture, and I see a few MS employees blogging about it demonstrating hosting ASP.NET vNext on Linux.
My understanding is that both Kestrel and Katana implement the OWIN pipeline.
From there it is all a bit fuzzy. I ask myself, why has Kestrel entered the picture, when it seems Katana could serve the same purpose if you compiled it with mono and made some efforts to make it cross platform compatible(perhaps easier said than done).
Do Kestrel and Katana serve the same purpose? Or is one specialized in some way that the other is not?
Will Kestrel eventually be a viable choice for Windows deployments? Or will it be specialized for non-Windows environments and Katana still the choice for Windows?
I recognize that I'm possibly asking for an apple to oranges comparison due to my lack of knowledge of Katana/Kestrel, but if the answer is "Oranges have more of an acidic taste than apples" then that IMO is a perfectly valid answer.
Katana is Microsoft's OWIN implementation and also includes some middleware components for security/authentication, serving static files, and a few other things.
Kestrel is Microsoft's cross-platform development web server that can be used with ASP.NET 5.
ASP.NET 5 does not implement OWIN, but has a "bridge" to enable OWIN components to be used in ASP.NET 5 applications, including running on Kestrel.
I still don't get a clear picture after reading other answers under this question, so I made some research and here's my conclusion:
OWIN is a specification, which defines an programming interface between a web server(like Kestrel and the ones provided by Katana) and a web application(the code by you).
Kestrel comes from ASP.NET Core. It's a OWIN compatible web server.
Katana comes from ASP.NET 4.X. It's a set of things of Microsoft's OWIN implementation, including OWIN servers.
Last but not least:
ASP.NET 5 is dead and replaced by ASP.NET Core. So don't mention it any more.
(Update at 2019/06/28: "Today, we’re announcing that the next release after .NET Core 3.0 will be .NET 5" - BY MS https://devblogs.microsoft.com/dotnet/introducing-net-5/. That means there will be ASP.Net 5, which is in fact the next generation of ASP.Net Core)
OWIN is the key/essential thing in both ASP.NET 4.X and ASP.NET Core.
For more, you may read https://www.quora.com/Is-ASP-NET-Core-a-replacement-for-OWIN-Katana
May be an old question, but since a quick google search led me here i think no one else asked a similar question.
Quoting ASP.NET 5 Documentation:
Kestrel
Kestrel is a cross-platform web server based on libuv, a cross-platform asynchronous I/O library. Kestrel is open-source, and you can view the Kestrel source on GitHub. You add support for Kestrel by including “Kestrel” in your project’s dependencies listed in project.json.
Choosing a server
If you intend to deploy your application on a Windows server, you should run IIS as a reverse proxy server that manages and proxies requests to Kestrel. If deploying on Linux, you should run a comparable reverse proxy server such as Apache or Nginx to proxy requests to Kestrel.
For self-hosting scenarios, such as running in Service Fabric, we recommend using Kestrel without IIS. However, if you require Windows Authentication in a self-hosting scenario, you should choose WebListener.
So, my understanding is: If Kestrel was only a development server, its not anymore and is somehow replacing Katana and OWIN.
"Project Katana" includes Microsoft adding support to IIS for OWIN, creating OwinHost.exe, and providing libraries to allow application to interface with a self hosting WebAPI. Some of these libraries such as Microsoft.Owin.Security are used by ASP.NET MVC 5 (not ASP.NET Core) to wire up identity/authentication through OWIN, but MVC 5 does not support self hosting(although it is possible using other tools). The SelfHosting library is only intended for WebAPI.
So "Katana" is a broad term referring to both host implementations as well as web application support for OWIN: "These components include both infrastructure components, such as hosts and servers, as well as functional components, such as authentication components and bindings to frameworks such as SignalR and ASP.NET Web API."
You may see phrases like "Migrate from Katana to ASP.NET Core" which refere to the web application side. Meaning abandoning the Microsoft.Owin libraries, and using ASP.NET Core which has full OWIN support built in without the need for additional libraries. Or you may see a similar phrase which means moving off of a Katana host to another host such as Kestrel. Unfortunately the term is used to refere to either side of the implementation with little clarification, and you'll have to pay attention to the context of the discussion.
Kestrel is just a host implementation. Its goal is to provide OWIN hosting support across many platforms. It is more lightweight, and not as full featured or mature as IIS. It is recommended to use it behind a reverse proxy of a more secure and rebust web server such as IIS, Apache, nginx, or other. Kestrel is what Microsoft's current documentation recommends as a host to deploy ASP.NET Core web application's on other platforms such as Linux.
If you create an ASP.Net Core project, then Kestrel is currently included by default. It is supported on the same platforms that ASP.NET Core supports.

Host ASP.NET App In WCF or Generic Web Server

Objective:
We have a Windows Service/generic EXE that also hosts a WCF service (.Net 3.5). I'd like to be able to take a third party ASP.NET component in a DLL, and host it through that WCF Service.
Is this possible to do, in any way?
It seems like if you want to host a ASP.NET app, it must be through IIS, but we don't use IIS.
Is there any way that we could load the ASP.NET app into memory, make the app available through an endpoint, and receive requests back from the app?
Specifically, we'd like to take the "Microsoft.ReportViewer.WebForms.dll", expose the web form in a web page, and accept any requests back from the web form.
http://msdn.microsoft.com/en-us/library/ms251723.aspx
Looking for anything to get me started. Thx.
From owin.org
"OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools."
Essentially Owin implementations, like Katana (OWIN implementations for Microsoft servers and frameworks.), help you self host web apps, even in a Windows NT Service.
According to this post, hosting a WebForms app outside IIS/ASP.NET is not possible.
WebForms are tightly coupled to ASP.NET/IIS and cannot run directly on
OWIN/Katana (e.g. outside of ASP.NET/IIS). However, you should be able
to use Katana's middleware (Security, CORS, etc.) in a WebForms
application.
http://katanaproject.codeplex.com/discussions/571291

Resources