Quantcast
Viewing all articles
Browse latest Browse all 239

How to Use Mono to Run ASP.NET C# Code in Ubuntu Linux

Mono is an open source implementation of Microsoft’s .NET Framework. It aims to help C# developers create cross-platform .NET applications. Although .NET Core is born for multiple platforms (Windows, Linux, and macOS), it is so far not a substitution of .NET framework. If you have an existing project written in .NET framework and want to run it in Linux, Mono is the most efficient way. In this post, I will share how to run an ASP.NET sample of Dynamic Web TWAIN using Mono in Ubuntu Linux.

Installing Mono in Ubuntu

Check the OS version:

$lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:    18.04
Codename:   bionic

Download Mono according to your Ubuntu version.

Install XSP:

sudo apt install mono-xsp4

How to Deploy ASP.NET Sample of Document Scanning and Uploading

More and more developers are using Dynamic Web TWAIN SDK to build web document management apps. Dynamic Web TWAIN is the only cross-platform web document scanning SDK designed for Windows, Linux, and macOS. The sample code of image upload provided by Dynamsoft is written in ASP.NET. Let’s see how to run it in Linux.

Run ASP.NET sample with Mono

Get the source code from https://github.com/Dynamsoft/Dynamic-Web-TWAIN:

cd ~
git clone https://github.com/Dynamsoft/Dynamic-Web-TWAIN.git
cd ~/Dynamic-Web-TWAIN/samples/Upload Download/Visual Studio Demo

Get a FREE 30-day trial license of Dynamic Web TWAIN.

Open UploadWithHTTP.html to set a valid license using JavaScript:

<script type="text/javascript">
Dynamsoft.WebTwainEnv.ProductKey = 'Your Trial License';
var console = window['console'] ? window['console'] : { 'log': function () { } };

Download dependent resources and extract them to a Resources folder as follows:

- Resources
- SaveToFile.aspx
- UploadWithHTTP.html

Run the project:

xsp4 --port 9000

Scan document in Ubuntu Linux

Install SANE:

sudo apt-get install sane

Visit http://localhost:9000/UploadWithHTTP.html. If you don’t have Dynamic Web TWAIN service installed, you need to install the .deb file and then refresh the page:

Image may be NSFW.
Clik here to view.
Linux Dynamic Web TWAIN

Scan documents and upload images to the server-side:

Image may be NSFW.
Clik here to view.
Scan document in Ubuntu Linux

Image may be NSFW.
Clik here to view.
Mono ASP.NET upload in Linux

You can also visit the page in Windows:

Image may be NSFW.
Clik here to view.
Scan and upload document in Windows

Related Articles

Source Code

https://github.com/Dynamsoft/Dynamic-Web-TWAIN/tree/master/samples/Upload%20Download/Visual%20Studio%20Demo

The post How to Use Mono to Run ASP.NET C# Code in Ubuntu Linux appeared first on Code Pool.


Viewing all articles
Browse latest Browse all 239

Trending Articles