Can ASP.NET CORE MVC be hosted in Xamarin App(Android)? - asp.net-core

I have a ASP.NET CORE MVC (.NET CORE 3.1) application running well on Kestrel in Windows, Now I'm wondering if possible to migrate it to Android via Xamarin?
The purpose of this move is the lower cost of Android device.
And I noticed: Run ASP.NET Core 3.0 apps with MonoVM
but seems no details?

No, Not yet (Jan 2021).
Xamarin, NetFramework, Net5, NetCore3 all support NetStandard. AspNetCore is based on NetCore, not NetStandard. If AspNetCore was a NetStandard library, it would support it, but AspNetCore uses other libraries in NetCore which do not exist on Xamarin.
By the way, if you need just a simple web server running on android like Kestrel, you can use EmdedIO. Indeed it doesn't support MVC, MVP, and MVVM, so you can not run AspNetCore app on Xamarin:
https://github.com/unosquare/embedio

Related

Migration of ASP.NET 4.6 Help Pages to .NET 6 (.net core)

In .NET framework we have support of Creating Help Page for Web API.
https://learn.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages
Does this feature supported in .NET 6. We are migrating our legacy ASP.NET framework application to .NET6.
How to migrate this feature to .NET6? If it is not supported in .Net6(.net core) how can we achieve the similar functionality in .Net core
I am trying to migrate this feature to .net core but I am facing issues on how to load the app data, register HelpdataConfig in .net core.
ITNOA
As you can see in ASP.NET help page for ASP.NET Core Web API, the Microsoft.AspNet.WebApi.HelpPage is for ASP.NET and does not for ASP.NET CORE or .NET 6, so you have to migrate this library to some popular Web API documentation libraries like Swagger
As you can see in ASP.NET Core web API documentation with Swagger / OpenAPI, you can use below documentation
By Christoph Nienaber and Rico Suter
Swagger (OpenAPI) is a language-agnostic specification for describing REST APIs. It allows both computers and humans to understand the capabilities of a REST API without direct access to the source code. Its main goals are to:
Minimize the amount of work needed to connect decoupled services.
Reduce the amount of time needed to accurately document a service.
The two main OpenAPI implementations for .NET are Swashbuckle and NSwag, see:
Getting Started with Swashbuckle
Getting Started with NSwag

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 publish service on IIS using ASP.NET Boilerplate?

As there is no documentation, Could you please provide steps to publish ASP.NET Boilerplate service on IIS Server
All the steps are same for Asp.Net Core which we have for a classical Asp.Net web application.
First, you need to install the .NET Core Hosting Bundle. Please find the steps below.
Navigate to the .NET All Downloads page.
Select the latest non-preview .NET Core runtime from the list (.NET
Core > Runtime > .NET Core Runtime x.y.z). Unless you intend to work
with preview software, avoid runtimes that have the word "preview" in
their link text.
On the .NET Core runtime download page under Windows, select the
Hosting Bundle Installer link to download the .NET Core Hosting
Bundle.
After all the above steps just follow the steps which you do for Asp.Net web application.

.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

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.