Crazy Idea: Run ASP.NET5 on Android?


#1

Hello Community,

After //build2015 and trying to put some pieces together, I was curious about a possibility that I could get some feedback to see if it is feasible/practical.

Essentially, after watching this (really great) session on ASP.NET5, it shows that it can run on Linux and Mac, if even on a thumbdrive! Pretty cool.

Well that got me thinking. If ASP.NET5 can run on Linux, and Linux is the OS for Droid, doesn’t that mean ASP.NET5 could possibly run on Droid?

It would be nothing short of awesome to create a Droid app that essentially hosts an ASP.NET5 server within it and serves up pages from that server (using a webview of some sort).

Is this possible? :smile:

Thanks for any assistance,
Michael


#2

If you don’t need it fully offline, you can use Apache Cordova for that


#3

I am trying to avoid JavaScript as much as possible. Which is why I would want to use ASP.NET5. :smile:


#4

This idea is cool and believe me, many are waiting for this to happen. I’m really curious how this is gonna start chewing into Xamarin’s market share and their outrageous licensing model.


#5

you would not be able to run asp.net 5 on android until coreclr is not ported to arm or x86. And then it is possible in fact very much possible as running asp.net5/coreclr requires 512mb ram which is available even on most phones and tablets now a days. But i am not sure how much practical that would be apart form just a demo.


#6

But i am not sure how much practical that would be apart form just a demo.

Thank you @shahid_pk for your reply. That’s really all we need to start from, a demo. :slight_smile: It can only grow from there. Even as a demo I should be able to share code between the hosting services that the client connects to, and the client itself. You cannot do this elegantly in JavaScript, unless you write your service-tier in JS. But who wants to do that? :wink:

There is also the matter of getting ASP.NET5 to run on iOS/iPhone to make it an ultimate solution.


#7

It’s not crazy. It’s “DARPA hard”. Android OS is based on Linux kernel. Which would suggest it “could” run. What would be needed and what would be needed to ship is out of my knowledge. Let’s say you’d be ready to pull a “hello world” application through with ASP.NET 5 and Android and you’d be ready for having it on Github, well, count me in :smile:

First, we could take in the vanilla ASP.NET implementation and pretty much disable everything and see if we can get it to compile on android. After success, we’d make it serve a port on one. Did you have any specific android environment/device in mind or should we aim to run this on some emulator?

Let’s say we’d be able to run ASP.NET on Android. What next? Setting up an SignalR endpoint reacting to your TV or what?

Feel free to mail me jani@lojaali.com


#8

Haha… is it wrong that I had to look up DARPA Hard? :stuck_out_tongue_winking_eye:

That’s cool it seems challenging. Unfortunately, I am not in a place to expend my soul into this. That already happened with Silverlight… which to this day I am still trying to find a worthy replacement for, hence my angle here (and also my vote here). :stuck_out_tongue:

Hopefully a bright and ambitious team can muster the resources together and make this happen.

Let’s say we’d be able to run ASP.NET on Android. What next? Setting up an SignalR endpoint reacting to your TV or what?

Haha… I do have a TV-based idea, so funny you say that. But no, I think what would be next is getting ASP.NET5 to run from iOS devices. :wink:


#9

I suspect that this will be an option before too long. I have no idea how well ASP.NET 5 will work as a client solution on Android, but its certainly worth a POC, as you suggest.

This PR is part of the solution for a general platform: https://github.com/dotnet/coreclr/pull/1210. Other pieces will naturally be needed too, like a JNI solution.


#10

yea as @richlander pointed to a pull request i guess sometimes crazy :smile: things do happen, we can make it happen.


#11

Not exactly what you’re looking for but it’s pretty much there - but check this out : https://docs.xamarin.com/guides/cross-platform/advanced/razor_html_templates/


#12

Nice @bbqchickenrobot! So you do NOT need a server reference/context to execute Razor? It’s just a template that can generate a string based on the data model that is bound to it. Very cool. Thanks for pointing that out. Definitely worth a consideration. :smile:


#13

I know, right? This would be a nice way to avoid using Xamarin’s services while still making good use of C# on mobile.


#15

Not such a crazy idea anymore is it? :smile: :smile: :smile:


#16

@DragonSpark, how would you do it now? Googling ‘Kestrel on Android’ isn’t giving me anything, although this would be the logical approach. It would be good to have (ironically) ‘Write Once Run Anywhere’ through a web application.


#17

@6pac I would follow either the Blazor project listed above, but also Ooui, which I am way more excited about:
http://ooui.mecha.parts/

Ooui is basically a WebSocket bridge which can be used not only in web scenarios but native scenarios as well. I consider this approach/strategy the answer to the request for a Ubiquitous .NET Client Model. I was the one that create that UserVoice too, FWIW. :slight_smile: I am in favor of this approach over Blazor’s as it is more lightweight and is not dependent on WebAssembly (although Ooui does support that, too). Blazor is WASM-only and cannot be leveraged for native scenarios like Ooui, either.

The only catch is that Ooui’s codebase is new and will take some time to mature with controls, behaviors, etc. But still, off to a good start.


.NET Foundation Website | Blog | Projects | Code of Conduct