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.
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.
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
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:
Scan documents and upload images to the server-side:
You can also visit the page in Windows:
- Cross-platform Web Document Scanning with ASP.NET Core
- Choosing between .NET Core and .NET Framework for server apps