The procedure you must follow is the following:
First of all you have to install Mono for QNAP (2.4.2.3) through a QPKG package (download it from here http://www.turbonas.com/phpBB3/viewtopic.php?f=18&t=942) and the upload it to qnap through QNAP administration console. The installation folder by QPKG will be: /share/HDA_DATA/.qpkg/mono.
Now you have to install through IPKG Apache2 (QNAP has pre installed Apache 1.3 as its web server but with this version its not simple to install mod-mono). Again into your NAS prompt the command:
Code: Select all
ipkg install apache
Code: Select all
User nobody
Group #-1
Here you must change these lines and put as user and group the guest so it will be:
Code: Select all
User guest
Group guest
After all you have to restart your new apache2 web server and everything will be ok on your NAS by the command:
Code: Select all
/share/HDA_DATA/.qpkg/Optware/sbin/apachectl restart
One usefull configuration in "httpd.conf" is to configure an error file to write inside in order to know whether Apache started or not. use a local file in your NAS disk such as:
Code: Select all
ErrorLog "/share/HDA_DATA/QBackup/tempo/error_log"
Code: Select all
LoadModule mono_module libexec/mod_mono.so
and restart your apache server and it will run successfully.
After that you have to install mono-apache-server2. This is the backend for mod_mono. It lets you run ASP.NET web applications via Apache. mod_mono will call mono-apache-server to parse and compile the aspx code. You can download this again from debian packages through link: http://packages.debian.org/sid/mono-apache-server2. Unzip it again with archive manager as you did it with mod-mono. Copy the files from the unzipped folder into the following locations (create any non existent folder):
Code: Select all
/etc/* => /share/HDA_DATA/.qpkg/mono/etc/*
/usr/* => /share/HDA_DATA/.qpkg/mono/usr/*
Another thing you must fix is the location of mono project that "/share/HDA_DATA/.qpkg/mono/usr/bin/mod-mono-server2" uses. Open this file and edit its contents as follows:
Code: Select all
#!/bin/sh
#exec /usr/bin/mono $MONO_OPTIONS "/usr/lib/mono/2.0/mod-mono-server2.exe" "$@"
exec /share/HDA_DATA/.qpkg/mono/usr/bin/mono $MONO_OPTIONS "/share/HDA_DATA/.qpkg/mono/usr/lib/mono/2.0/mod-mono-server2.exe" "$@"
Code: Select all
#!/bin/sh
exec /usr/local/mono/bin/mono --security /usr/local/mono/lib/mono/2.0/mod-mono-server2.exe "$@"
Code: Select all
chmod +x /share/HDA_DATA/.qpkg/mono/usr/bin/mod-mono-server2
And by restarting your apache everything will be fine.
Now you have to fix also the issues with the configuration files. You can get and put the configuration files got from mod-mono and mono-apache, into folder: "/share/HDA_DATA/.qpkg/Optware/etc/apache2/extra" and configure them properly into httpd.conf (http://go-mono.com/config-mod-mono/). However, i will give you a small-fast but messy configuration in order to test it.
Code: Select all
#Generic Code
<IfModule mod_mono.c>
MonoUnixSocket default /opt/tmp/.mod_mono_server2
MonoServerPath default /share/HDA_DATA/.qpkg/mono/usr/bin/mod-mono-server2
AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
MonoApplicationsConfigDir default /share/HDA_DATA/.qpkg/mono/etc/mono-server2
MonoPath default /share/HDA_DATA/.qpkg/mono/usr/lib/mono/2.0:/usr/lib
</IfModule>
#End Of generic code
AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
DirectoryIndex index.aspx
# Here it says that path for Mono Server will be the "/share/HDA_DATA/.qpkg/Optware/bin/mod-mono-server2" and will serve for "mynewsite" application
MonoServerPath mynewsite "/share/HDA_DATA/.qpkg/mono/usr/bin/mod-mono-server2"
# and for Secure: MonoServerPath mynewsite "/share/HDA_DATA/.qpkg/mono/usr/bin/mod-mono-server2_Secure"
# this is the path that my application by name "mynewsite" relies:
MonoApplications mynewsite "/mynewsite:/share/HDA_DATA/QBackup/tempo"
# Here we define the path for mono project where it is into our system
MonoPath mynewsite /share/HDA_DATA/.qpkg/mono/usr/lib/mono/2.0
# and provide an alias to the web server what user should put in browser is http://MyNasAddress:8888/mynewsite/
# /share/HDA_DATA/QBackup/tempo/ is the application physical path
Alias /mynewsite "/share/HDA_DATA/QBackup/tempo/"
<Location "/mynewsite">
Allow from all
Order allow,deny
MonoSetServerAlias mynewsite
# here we say that this site will be handled from mono
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
</IfModule>
Code: Select all
"E:\tmp\DbLinq-0.20.1\>
DbMetal.exe --u=testuser --password=testuser --server=MyNasServerAddress --database=MyDBName --provider=MySql --pluralize --namespace=DataConnectivity --case=leave --language=C# --code="E:\tmp\DbLinq-0.20.1\DataConnectivity.cs"
Code: Select all
public MyDBName(): this (new MySqlConnection(ConfigurationManager.AppSettings[@"MySqlConnectionString"].ToString()))
{
this.OnCreated();
}
Don't forget to use in you project the DbLinq.dll and DbLinq.MySql.dll and MySql.Data.dll(don't forget that if MySql.Data is installed in mono gac /share/HDA_DATA/.qpkg/mono/usr/lib/mono/gac/MySql.Data/ then it can be used from there and has to be absent from project directory. Take also care to have the same version).