Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web API and .NET Standard

Tags:

c#

.net

asp.net

Context:

I'm currently on application including many subproject based on .NET Standard (for Xamarin).

This application need to run Kestrel Web Server to expose an API (application must be callable from external to receive updated datas).

So, I have created an ASP.NET Core project permitting to make easily a WebApi and run a server (Kestrel). Problem, It's a .NET Core project and it's incompatible with Xamarin.

Objectives:

  • The application must be callable from external (expose an API)
  • The application must used .NET Standard Projects (compatibility with Xamarin)
  • The application must run on desktop and mobile

Questions:

  • Will WebAPI included in futures releases of .NET Standard?
  • Does it seems complicated to expose an API (and so, run a server) in mobile app (and not a good practice by the way)?
  • Is there any other way to do this work?
like image 957
Sir Kiwi Avatar asked Mar 13 '26 18:03

Sir Kiwi


1 Answers

Objectives:

•The application must be callable from external (expose an API)

Get a web server serving as middle man and passing the request it got from external then it should be doable

•The application must used .NET Standard Projects (compatibility with Xamarin)

Web API runs on server and Xamarin runs on mobile/Desktop, Xamarin shouldn't have to worry about what tech stack the server uses as long as it complies with the protocol both agrees on (http)

•The application must run on desktop and mobile

Not an issue

Questions:

•Will WebAPI included in futures releases of .NET Standard ?

Definitely yes.

•Does it seems complicated to expose an API (and so, run a server) in mobile app (and not a good practice by the way) ?

Totally wrong way to do it. your app will lost internet connection whenever the phone decides to sleep for a while plus the phone is just not designed to serve as a server.

•Is there any other way to do this work?

Get a real cloud server instead and run your API there.

like image 86
Steve Avatar answered Mar 16 '26 10:03

Steve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!