Jump to content

How do I configure mod_mono on Windows


sagnik

Recommended Posts

Hi! I've installed Mono 5.18 (using msi installer). But the problem is the mod_mono.so & mod_mono.conf are missing from the installation. So I'm unable to configure Apache 2.4 (64Bits) to load mod_mono module.

My question is, how can I get those files or how can I run mod_mono with Apache 2.4 (64Bits) on Windows (64Bits)?

Link to comment
Share on other sites

Well, I've already checked that link but they've only 32bits version of mod_mono for Apache 2.2. But something I found the mod_mono.so (64bits) and created an mod_mono.conf file and included it to httpd.conf. But when I've run an aspx file it gave me a 503 Service Unavailable error. Actually I don't know if mod_mono is working or not. And I want to run mod_mono for whole not only from a specific folder like "mydomain.com/mono/" which is described everywhere in the Internet.

Link to comment
Share on other sites

Actually I've not used Linux before. So it will be a problem for me to switch to Linux now. But I need to run mod_mono somehow on Windows. There is a module exists which is mod_aspdotnet but it supports Apache 2.2 only. For now can you tell me why the aspx file giving a Error 503.

Link to comment
Share on other sites

503 is the error that asp.net gives when apache is up but mono isn't working.

 

Maybe Wolstech, as the resident windows expert, has some ideas. This whole thing is kind of making me chuckle though because asp.net is a windows thing, and mono was made to run this windows only thing on Linux, and now you're running this thing on Windows that was designed to run Windows technology on Linux. It reminds me of plugging an AC to DC adapter into the wall, and then hooking a DC to AC power inverter to it.

  • Like 1
Link to comment
Share on other sites

The Apache Mono plug-in is not available for Windows to my knowledge. It might be possible to build it for Windows using the source since Apache and Mono are both open source, but that's beyond my capability.

 

There's no good reason to use Mono on Windows anyway... it's entire purpose is to simulate asp.net. You have access to real asp.net on Windows, so the entire endeavor is pointless...

 

I'd suggest you install IIS and ASP.Net, and call it a day. All Windows Server 2008 R2+, and most versions of Windows 7, 8.x, and Windows 10 (basically any that's not the "Home" version) include it built in as an optional feature, you just have to turn it on. (Home versions require you to buy the Pro upgrade). Be aware you have to install IIS first, then go back for a second round and add the ASP.net web services after installing IIS.

Link to comment
Share on other sites

I know but to do it I need to change everything in my websites as I'm running 7 Virtual Host. For example, when I'm including a file in PHP. But I need to run ASP.NET on Windows for college project. My project is to build a website in PHP, but for some specific pages use ASP.NET. My college also suggests to use Linux but I thought I'm already running an Apache server on Windows why not complete the project on the same server instead of installing Linux on my computer. Somehow I've found a Windows (64bits) version of mod_mono.so from a forum (a user on the forum built a x86 & x64 versions for Windows using msvc). So I've downloaded it and loaded with httpd & it has been loaded successfully. But now I'm getting a 503 Service Unavailable error on aspx pages. But when I visit /mono/ directory which is the control panel of mod_mono which is loaded using SetHandler mono-ctrl, I can see the contents. But the other, for example, I've created a simple aspx page on / (http://localhost/test.aspx) to check if mod_mono is working or not, the aspx page is showing a 503 Service Unavailable error.

Link to comment
Share on other sites

Here is the Apache error.log:

 

[Fri Jan 11 12:34:23.936929 2019] [auth_digest:notice] [pid 6240:tid 1028] AH01757: generating secret for digest authentication ...
[Fri Jan 11 12:34:26.655602 2019] [:error] [pid 6240:tid 1028] mod_mono: connect error (Unknown error). Address: 127.0.0.1 Port: 2000
[Fri Jan 11 12:34:26.655602 2019] [:error] [pid 6240:tid 1028] Failed running 'C:\\Program Files\\Mono\\lib\\mono\\gac\\mod-mono-server4\\4.4.0.0__0738eb9f132ed756\\mod-mono-server4 --address 127.0.0.1 --port 2000 --nonstop --master (null) (null) (null) (null) (null) (null)'. Reason: Unknown error
[Fri Jan 11 12:34:26.718099 2019] [mpm_winnt:notice] [pid 6240:tid 1028] AH00354: Child: Starting 64 worker threads.
Link to comment
Share on other sites

Okay! I've solved it by creating a mod-mono-server4.bat file in /bin directory and changing MonoServerPath to "C:\Program files\Mono\bin\mod-mono-server4.bat" but now I can visit the control panel of mod_mono. As I can now use the mod_mono control panel I've started the mod_mono server which was labelled as default. But now I'm getting a 500 Internal Server Error when I visit a file "localhost/hello.aspx". But the file is working fine when I run "xsp4 --port 9000" and visit localhost:9000/hello.aspx.

Link to comment
Share on other sites

Here is my mod_mono.conf:

# mod_mono.conf

# Achtung! This file may be overwritten
# Use 'include mod_mono.conf' from other configuration file
# to load mod_mono module.

<IfModule !mod_mono.c>
    LoadModule mono_module modules/mod_mono.so
</IfModule>
<IfModule mono_module>
    AddType application/x-asp-net .config .cs .csproj .dll .resources .resx .sln .vb .vbproj
    AddType application/x-asp-net .asax .ascx .ashx .asmx .aspx .axd .browser .licx .master .rem .sitemap .skin .soap .webinfo
    
	#AddHandler mod_mono .asax .ascx .ashx .asmx .aspx .axd .browser .licx .master .rem .sitemap .skin .soap .webinfo .config .cs .csproj .dll .resources .resx .sln .vb .vbproj

    MonoAutoApplication disabled
	MonoPath "C:\Program Files\Mono"
	#MonoServerPath "C:\Program Files\Mono\lib\mono\gac\mod-mono-server4\4.4.0.0__0738eb9f132ed756\mod-mono-server4"
	#MonoServerPath "C:\Program Files\Mono\lib\mono\4.5\mod-mono-server4.exe"
	#MonoServerPath "C:\Program Files\Mono\bin\mod-mono-server4.bat"
	MonoServerPath "C:\Program Files\Mono\bin\xsp4.bat"
	#MonoListenAddress 127.0.0.1
	MonoListenPort 80
	#MonoWapiDir "E:/httpd/htdocs"
	MonoApplications "/:E:\httpd\htdocs"
	#MonoApplicationsConfigFile "E:/httpd/htdocs/web.config"
	#MonoApplicationsConfigDir "E:/httpd/htdocs/webapp"
	MonoDebug true

    <IfModule dir_module>
		DirectoryIndex index.aspx
        DirectoryIndex Default.aspx
		DirectoryIndex default.aspx
    </IfModule>

    <DirectoryMatch "/(bin|App_Code|App_Data|App_GlobalResources|App_LocalResources)/">
        Order deny,allow
        Deny from all
    </DirectoryMatch>
	<Location "/">
		#MonoSetServerAlias default
		Allow from all
		Order allow,deny
		SetHandler mono
		SetOutputFilter DEFLATE
		SetEnvIfNoCase REQUEST_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
		AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
	</Location>
    <Location "/mono">
        #Allow from 127.0.0.1::1
        SetHandler mono-ctrl
    </Location>
</IfModule>
Here is my current error.log:

[Fri Jan 11 16:33:55.693634 2019] [mpm_winnt:notice] [pid 3276:tid 1100] AH00424: Parent: Received restart signal -- Restarting the server.
[Fri Jan 11 16:33:56.834309 2019] [:error] [pid 3276] mod_mono: connect error (Unknown error). Address: 127.0.0.1 Port: 2000
[Fri Jan 11 16:33:57.724921 2019] [mpm_winnt:notice] [pid 4572:tid 1028] AH00364: Child: All worker threads have exited.
[Fri Jan 11 16:33:58.006145 2019] [auth_digest:notice] [pid 3276:tid 1100] AH01757: generating secret for digest authentication ...
[Fri Jan 11 16:33:59.115484 2019] [:error] [pid 4572:tid 1028] mod_mono: connect error (Unknown error). Address: 127.0.0.1 Port: 2000
[Fri Jan 11 16:33:59.115484 2019] [:warn] [pid 4572:tid 1028] (OS 6)The handle is invalid.  : Failed to release dashboard lock after destroying the dashboard
[Fri Jan 11 16:34:00.521695 2019] [mpm_winnt:notice] [pid 3276:tid 1100] AH00455: Apache/2.4.23 (Win64) OpenSSL/1.0.2j mod_mono/3.12 mod_wsgi/4.6.5 Python/3.6 PHP/7.1.1 configured -- resuming normal operations
[Fri Jan 11 16:34:00.521695 2019] [mpm_winnt:notice] [pid 3276:tid 1100] AH00456: Server built: Sep  6 2016 21:33:53
[Fri Jan 11 16:34:00.521695 2019] [core:notice] [pid 3276:tid 1100] AH00094: Command line: 'E:\\httpd\\bin\\httpd.exe -d E:/httpd'
[Fri Jan 11 16:34:00.521695 2019] [mpm_winnt:notice] [pid 3276:tid 1100] AH00418: Parent: Created child process 8232
[Fri Jan 11 16:34:01.881019 2019] [auth_digest:notice] [pid 8232:tid 1032] AH01757: generating secret for digest authentication ...
[Fri Jan 11 16:34:03.943454 2019] [mpm_winnt:notice] [pid 8232:tid 1032] AH00354: Child: Starting 64 worker threads.
And here is a screenshot of an aspx page working without apache by running xsp4 --port 9000 & visiting localhost:9000/hello.aspx:

https://imgur.com/a/5LasWhP

 

Here is the screenshot of the same aspx page showing 500 Error with Apache:

https://imgur.com/a/bxISYUB

Link to comment
Share on other sites

Okay! I've changed the port to 2000. Now I'm getting 503 Service Unavailable. Here is the error log:

[Fri Jan 11 18:06:21.180002 2019] [mpm_winnt:notice] [pid 3276:tid 1100] AH00424: Parent: Received restart signal -- Restarting the server.
[Fri Jan 11 18:06:22.511253 2019] [:error] [pid 3276] mod_mono: connect error (Unknown error). Address: 127.0.0.1 Port: 2000
[Fri Jan 11 18:06:23.226797 2019] [mpm_winnt:notice] [pid 8232:tid 1032] AH00364: Child: All worker threads have exited.
[Fri Jan 11 18:06:24.429895 2019] [auth_digest:notice] [pid 3276:tid 1100] AH01757: generating secret for digest authentication ...
[Fri Jan 11 18:06:24.881508 2019] [:error] [pid 8232:tid 1032] mod_mono: connect error (Unknown error). Address: 127.0.0.1 Port: 2000
[Fri Jan 11 18:06:27.465706 2019] [mpm_winnt:notice] [pid 3276:tid 1100] AH00455: Apache/2.4.23 (Win64) OpenSSL/1.0.2j mod_mono/3.12 mod_wsgi/4.6.5 Python/3.6 PHP/7.1.1 configured -- resuming normal operations
[Fri Jan 11 18:06:27.465706 2019] [mpm_winnt:notice] [pid 3276:tid 1100] AH00456: Server built: Sep  6 2016 21:33:53
[Fri Jan 11 18:06:27.465706 2019] [core:notice] [pid 3276:tid 1100] AH00094: Command line: 'E:\\httpd\\bin\\httpd.exe -d E:/httpd'
[Fri Jan 11 18:06:27.465706 2019] [mpm_winnt:notice] [pid 3276:tid 1100] AH00418: Parent: Created child process 1864
[Fri Jan 11 18:06:28.725957 2019] [auth_digest:notice] [pid 1864:tid 1032] AH01757: generating secret for digest authentication ...
I think apache couldn't connect to mod_mono using port 2000. But I can't figure out why!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...