How to get ASP.NET running on Apache on CentOS 7?

5,658

I think you miss one set in the configuration of apache with mono. I strongly suggest you to check this guide is for Ubuntu. I tried and it works fine with xsp and apache. I test some examples and work fine for everything except WCF (svc). Apparently, that support it still with a lot of problems in mono 2.10.

http://www.bgsoftfactory.net/run-asp-net-mvc-4-with-mysql-on-linux/

I think the problem could be that the virtual host is not active. But, that is a simple hunch.

Share:
5,658

Related videos on Youtube

Jürgen Bayer
Author by

Jürgen Bayer

Author of the German C# 2012 Codebook and some other .NET books. I am a freelancer working with .NET since version 1.0 for German customers focussing on new techologies, clean code and agile development. XING page: http://www.xing.com/profile/Juergen_Bayer13 LinkedIn page: lnkd.in/txTSk3 #in

Updated on September 18, 2022

Comments

  • Jürgen Bayer
    Jürgen Bayer over 1 year

    I successfully installed Apache, Mono, XSP Server and MonoDevelop on a CentOS 7 machine, basically following http://www.mono-project.com/docs/getting-started/install/linux/#centos-fedora-and-derivatives (with added yum install -y xsp, and yum install -y monodevelop. Mono Develop works and I can create and run ASP.NET websites with it (via XSP Server).

    But I need to integrate Mono with Apache. To do this I installed mod_mono (yum install -y mod_mono) and created a configuration for a test application via http://go-mono.com/config-mod-mono/. I changed the mono server version to 4 and added granting open access:

    Alias /mono-test "/srv/www/mono-test"
    MonoServerPath mono-test "/usr/bin/mod-mono-server4"
    MonoDebug mono-test true
    MonoApplications mono-test "/mono-test:/srv/www/mono-test"
    <Location "/mono-test">
      Allow from all
      Order allow,deny
      MonoSetServerAlias mono-test
      SetHandler mono
      SetOutputFilter DEFLATE
      SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
      # Allow open access:
      Require all granted
    </Location>
    
    <IfModule mod_deflate.c>
      AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
    </IfModule>
    

    I placed the file in /etc/httpd/confd with the name x-mono-test.conf, to be sure it is loaded after the default mod_mono.conf (content see at the end of this question).

    The problem is that accessing a test aspx file in the Apache application (http://localhost/mono-test/test.aspx) results in a HTTP 503 - Service Unavailable. The Apache error log remains empty.

    I would like to know what could be wrong or how I could find the source of this issue.

    Content of mod_mono.conf:

    <IfModule !mod_mono.c>
        LoadModule mono_module /usr/lib64/httpd/modules/mod_mono.so
    </IfModule>
    
    <IfModule mod_headers.c>
        Header set X-Powered-By "Mono"
    </IfModule>
    
    AddType application/x-asp-net .aspx
    AddType application/x-asp-net .asmx
    AddType application/x-asp-net .ashx
    AddType application/x-asp-net .asax
    AddType application/x-asp-net .ascx
    AddType application/x-asp-net .soap
    AddType application/x-asp-net .rem
    AddType application/x-asp-net .axd
    AddType application/x-asp-net .cs
    AddType application/x-asp-net .vb
    AddType application/x-asp-net .master
    AddType application/x-asp-net .sitemap
    AddType application/x-asp-net .resources
    AddType application/x-asp-net .skin
    AddType application/x-asp-net .browser
    AddType application/x-asp-net .webinfo
    AddType application/x-asp-net .resx
    AddType application/x-asp-net .licx
    AddType application/x-asp-net .csproj
    AddType application/x-asp-net .vbproj
    AddType application/x-asp-net .config
    AddType application/x-asp-net .Config
    AddType application/x-asp-net .dll
    DirectoryIndex index.aspx
    DirectoryIndex Default.aspx
    DirectoryIndex default.aspx
    
  • DavidPostill
    DavidPostill almost 8 years
    This is really a comment and not an answer to the original question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. Please read Why do I need 50 reputation to comment? What can I do instead?
  • Juan Acosta
    Juan Acosta almost 8 years
    If anyone is working on WCF in Linux. I strongly recommend to check this project github.com/dotnet/wcf It is currently in development and have several persons collaborating constantly.