Mega
Mega

Reputation: 565

Execute C# code on Centos (Linux)?

I have simple C# console application developed in Visual Studio 2008, which writes information in MySQL database. Is it possible to run the application in my hosting environment (Cent OS, with local MySQL database)? I have only control panel or ftp access to my hosting space. The database is only accessible from local (from the hosting space).

I have read something about Mono/Monodevelop, but those need to be run on the Cent OS, right? I don't have access to install this or other staffs on the hosting environment.

Upvotes: 1

Views: 5799

Answers (3)

Greg Buehler
Greg Buehler

Reputation: 3894

If your hosting provider allows it, has mono installed, and you've verified that your application runs under mono you may be able to invoke the program via a shell command from php.

<?php
$output = shell_exec('mono myprogram.exe');
echo "<pre>$output</pre>";
?>

Upvotes: 2

kitti
kitti

Reputation: 14834

If your host has mono installed, and you have the ability to execute arbitrary shell commands from PHP, then you can run it. Otherwise no. Do you have the source to the program? If so, I would just port the code to PHP (or whatever your host provides).

Upvotes: 1

David
David

Reputation: 73594

Given what you've specified about the environment and your limitations, not you can't run it.

You will need to have Mono installed to run a .NET app on Linux. If you can't install it, you're probably out of luck.

You could check with your hosting provider to see if they have other options.

Upvotes: 2

Related Questions