如何让 ASP.NET 在 CentOS 7 上的 Apache 上运行?

如何让 ASP.NET 在 CentOS 7 上的 Apache 上运行?

我在 CentOS 7 机器上成功安装了 Apache、Mono、XSP Server 和 MonoDevelop,基本如下:http://www.mono-project.com/docs/getting-started/install/linux/#centos-fedora-and-derivatives(添加了yum install -y xspyum install -y monodevelop。Mono Develop 可以工作了,我可以用它创建和运行 ASP.NET 网站(通过 XSP Server)。

但我需要将 Mono 与 Apache 集成。为此,我安装了mod_mono( yum install -y mod_mono) 并通过以下方式为测试应用程序创建了配置http://go-mono.com/config-mod-mono/。我将mono服务器版本改为4,并添加了授予开放访问权限:

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>

我将文件放置在/etc/httpd/confd名为 的位置x-mono-test.conf,以确保它在默认之后加载mod_mono.conf(内容请参见本问题末尾)。

问题是访问 Apache 应用程序中的测试 aspx 文件(http://localhost/mono-test/test.aspx) 导致 HTTP 503 - 服务不可用。Apache 错误日志保持为空。

我想知道哪里出了问题或者如何找到这个问题的根源。

内容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

答案1

我认为您在配置带有 mono 的 apache 时遗漏了一组。我强烈建议您检查一下本指南是否适用于 Ubuntu。我试过了,它与 xsp 和 apache 配合得很好。我测试了一些示例,除了 WCF (svc) 之外,其他一切都运行良好。显然,在 mono 2.10 中,它对它的支持仍然存在很多问题。

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

我认为问题可能是虚拟主机未处于活动状态。但这只是一个简单的猜测。

相关内容