Jump to content


Photo

How do I configure mod_mono on Windows


  • Please log in to reply
34 replies to this topic

#1 sagnik

sagnik

    Rank VI Member

  • Members
  • PipPipPipPipPipPip
  • 407 posts
  • Gender:Male
  • Location:Durgapur, West Bengal, India
  • Interests:Internet, Computer, Coding, Website Designing

Posted 10 January 2019 - 05:00 PM

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)?
- By Sagnik

#2 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 17,313 posts
  • Gender:Male

Posted 10 January 2019 - 07:55 PM

Maybe this will help https://anmar.eu.org/mono/mod_mono/ I have no idea about windows.

#3 sagnik

sagnik

    Rank VI Member

  • Members
  • PipPipPipPipPipPip
  • 407 posts
  • Gender:Male
  • Location:Durgapur, West Bengal, India
  • Interests:Internet, Computer, Coding, Website Designing

Posted 10 January 2019 - 08:07 PM

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.
- By Sagnik

#4 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 17,313 posts
  • Gender:Male

Posted 10 January 2019 - 08:11 PM

Well, if you decide to switch to Linux let me know and I'll be able to help you.

#5 sagnik

sagnik

    Rank VI Member

  • Members
  • PipPipPipPipPipPip
  • 407 posts
  • Gender:Male
  • Location:Durgapur, West Bengal, India
  • Interests:Internet, Computer, Coding, Website Designing

Posted 10 January 2019 - 08:17 PM

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.
- By Sagnik

#6 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 17,313 posts
  • Gender:Male

Posted 10 January 2019 - 09:08 PM

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.

#7 wolstech

wolstech

    Rank X Member

  • Root Admin
  • 9,556 posts
  • Gender:Male
  • Location:Pennsylvania

Posted 11 January 2019 - 03:05 AM

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.

Please do not PM me for support. Posting on our forums lets all of us learn.

Do you play Minecraft? | Server Monitors | And the Dumbass of the Decade award goes to...


#8 sagnik

sagnik

    Rank VI Member

  • Members
  • PipPipPipPipPipPip
  • 407 posts
  • Gender:Male
  • Location:Durgapur, West Bengal, India
  • Interests:Internet, Computer, Coding, Website Designing

Posted 11 January 2019 - 04:45 AM

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.
- By Sagnik

#9 sagnik

sagnik

    Rank VI Member

  • Members
  • PipPipPipPipPipPip
  • 407 posts
  • Gender:Male
  • Location:Durgapur, West Bengal, India
  • Interests:Internet, Computer, Coding, Website Designing

Posted 11 January 2019 - 07:09 AM

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.

- By Sagnik

#10 wolstech

wolstech

    Rank X Member

  • Root Admin
  • 9,556 posts
  • Gender:Male
  • Location:Pennsylvania

Posted 11 January 2019 - 10:49 AM

Do you have Mono itself installed, and does it work if used outside of Apache? That error is saying it can't start Mono to run the script.

Please do not PM me for support. Posting on our forums lets all of us learn.

Do you play Minecraft? | Server Monitors | And the Dumbass of the Decade award goes to...


#11 sagnik

sagnik

    Rank VI Member

  • Members
  • PipPipPipPipPipPip
  • 407 posts
  • Gender:Male
  • Location:Durgapur, West Bengal, India
  • Interests:Internet, Computer, Coding, Website Designing

Posted 11 January 2019 - 10:59 AM

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.
- By Sagnik

#12 sagnik

sagnik

    Rank VI Member

  • Members
  • PipPipPipPipPipPip
  • 407 posts
  • Gender:Male
  • Location:Durgapur, West Bengal, India
  • Interests:Internet, Computer, Coding, Website Designing

Posted 11 January 2019 - 11:17 AM

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
- By Sagnik

#13 wolstech

wolstech

    Rank X Member

  • Root Admin
  • 9,556 posts
  • Gender:Male
  • Location:Pennsylvania

Posted 11 January 2019 - 12:30 PM

MonoListenPort 80

I think this needs to be changed to 2000. The error log shows Apache trying to connect to Mono on port 2000, but these settings imply Mono would start on port 80 (and fail since 80 is occupied by Apache).


Please do not PM me for support. Posting on our forums lets all of us learn.

Do you play Minecraft? | Server Monitors | And the Dumbass of the Decade award goes to...


#14 sagnik

sagnik

    Rank VI Member

  • Members
  • PipPipPipPipPipPip
  • 407 posts
  • Gender:Male
  • Location:Durgapur, West Bengal, India
  • Interests:Internet, Computer, Coding, Website Designing

Posted 11 January 2019 - 12:39 PM

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!
- By Sagnik

#15 wolstech

wolstech

    Rank X Member

  • Root Admin
  • 9,556 posts
  • Gender:Male
  • Location:Pennsylvania

Posted 11 January 2019 - 01:56 PM

Have you tried manually starting Mono on port 2000, leaving it running in the background, verifying you can reach 127.0.0.1:2000, then restarting Apache while Mono is already running and testing through Apache?


Please do not PM me for support. Posting on our forums lets all of us learn.

Do you play Minecraft? | Server Monitors | And the Dumbass of the Decade award goes to...





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users