Apache24 with mod_mono

Zvoni

Member

Reaction score: 24
Messages: 67

Hi Folks,
could use some help.
FreeBSD12.1-p5
Apache24 2.4.43 and mod-mono 3.13
Following these instructions (albeit for Apache24 and using pkg instead of ports): https://www.rhyous.com/2011/03/02/asp-net-web-services-on-freebsd-and-apache-using-mono/
using standard-installation my error-log shows
Cannot open assembly '/usr/local/lib/mono/4.5/mod-mono-server2.exe': No such file or directory.
For the test-app which comes with the install (c/p from xsp-folder)

Looking in the above mentioned folder /usr/local/lib/mono/4.5/ i can see a mod-mono-server4.exe (which in itself is a symlink to somewhere else)
MonoServerPath /usr/local/lib/mono/4.5/mod-mono-server4.exe
in my mod_mono.conf created an error "exec format error"
So i created a symlink for mod-mono-server2.exe pointing to the same target as the server4.exe

When i call now the page i get an error 500
System.IO.IOException
kevent() error at initial event registration, error code = '9'

What am i doing wrong?
No experience whatsoever with apache

EDIT: I forgot: I already did chmod -R 755 and chown -R www:www for this test-folder
 

reddy

Member

Reaction score: 42
Messages: 84

In mod_mono.conf, try setting the directive MonoTargetFramework to "4.0" by adding the line:

Code:
MonoTargetFramework   "4.0"
And remove the symlink that you have created. As per the mod_mono man page, transparently creating the symlink like you have done tells the runtime to load .NET Framework 2.0 while your application most likely requires .NET 4/4.5. The documentation does not list "4.5" as a supported value but I think the mono-server 4.0 runtime is also able to run applications using the .NET Framework 4.5.

If you want to use the MonoServerPath directive instead, I would recommend enclosing the path within double quotes, as seen on the Mono website (ignore the AutoConfiguration discussion of the page, the important point is just the syntax of this specific directive). Thus your directive would become:

Code:
 MonoServerPath "/usr/local/lib/mono/4.5/mod-mono-server4.exe"
Using the MonoServerPath directive is a more explicit configuration approach and thus may be a preferable approach to reduce guess work (when debugging).
 
OP
Z

Zvoni

Member

Reaction score: 24
Messages: 67

Nope.
If i remove the symlink, i'm back at "Cannot open assembly '/usr/local/lib/mono/4.5/mod-mono-server2.exe': No such file or directory."
Tried with MTF and MSP. Still tries to load mod-mono-server2.exe
even tried "/usr/local/bin/mod-mono-server4" for MSP. same result.

EDIT: The Control-Panel works
 

reddy

Member

Reaction score: 42
Messages: 84

Mmmh, are you sure that your mod_mono.conf file is being loaded by the main Apache configuration file? Your httpd.conf file should include a line like:

Code:
include mod_mono.conf
I guess this should already be the case since Apache gets to the point where it tries to load mod-mono-server2.exe, but just to double check the most obvious first. Also, have you restarted the Apache server after changing the configuration file? You can do so by running the following as root:

Code:
service apache24 restart
Also which control panel are you talking about? Did it start working after you changed the .conf file or does it work since the beginning?
 
OP
Z

Zvoni

Member

Reaction score: 24
Messages: 67

Hi reddy,
sorry for late reply. Was out of house yesterday.
The Include conf works (last line in httpd.conf), since when i tried an option in mod_mono.conf i had a typo, und apache complained during start
@Control-Panel: The one where the Handler is mono-ctrl. Worked from the start

Right now i have the problem, that the machine i have the problem with is out of reach for the next 7-10 days.
I'm going to fire up VM with the same config
 
OP
Z

Zvoni

Member

Reaction score: 24
Messages: 67

Right.
Vanilla-Install of FreeBSD 12.1-p5 inside a VM.
pkg install apache24 ap24-mod_mono
Followed instructions of the site in Post 1
same result --> Tries to start mod-mono-server2 --> No Such File
rerouted it to mod-mono-server4 (incl. rerouting xsp2 to xsp4) --> IOException.
Question: "Who" starts the mod-mono-server? apache? the ASP-App? Where is the config for it?

Does anyone have a "working" ASP-sample-application i could try with?
 
Top