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.
About Dynamic Web TWAIN
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
Deploying Web Document Management App in Linux
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 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/yushulx/asp-net-document-management:
git clone https://github.com/yushulx/asp-net-document-management.git cd asp-net-document-management
Extract the latest
Resources folder from Dynamic Web TWAIN installer and copy it to the project root directory:
- Resources - SaveToFile.aspx - UploadWithHTTP.html
You need a FREE 30-day trial license to make Dynamic Web TWAIN SDK work.
Once you get a valid license, you can set it in
Dynamsoft.DWT.ProductKey = 'LICENSE-KEY';
Run the project:
xsp4 --port 9000
Scan documents in a Linux web browser
sudo apt-get install sane
http://localhost:9000/UploadWithHTTP.html in a web browser. 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