问题描述
可以修改 mod_mono 的 AutoHosting 以支持 ASP.NET 吗?ATM 它实际上不起作用:链接./有效,但运行时完全忽略 Global.asax 并且不遵循路由约定.
Can mod_mono's AutoHosting be modified to support ASP.NET? ATM it doesn't really work: Link. / works, but the runtime ignores Global.asax altogether and doesn't follow the routing conventions.
推荐答案
在 Mono 中 AutoHosting 的目的是通过减少工作量,让某人尽可能轻松地快速获得托管在 Mono 上的 ASP.NET 站点需要配置服务器;但是,它通过托管已配置为 ASP.NET 文件类型的文件类型来实现.您可以在 mod_mono.conf 文件中找到它配置为托管的文件扩展名.
The purpose of AutoHosting in Mono is to make it as easy as possible for someone to quickly get an ASP.NET site hosted on Mono by reducing the amount of effort needed to configure the server; however, it does so by hosting file types which have been configured as ASP.NET file types. You can find the file extensions it is configured to host in the mod_mono.conf file.
由于 MVC 路由避免使用文件扩展名,它可能不是 MVC 托管的好解决方案.也就是说,如果您绝对必须使用 AutoHosting,您可以将以下内容添加到您的 mod_mono.conf 文件中,以将服务器的所有内容设置为 x-asp-net 内容:ForceType 应用程序/x-asp-net
Since MVC Routing avoids using file extensions, it is probably just not a good solution for MVC hosting. That said, if you absolutely must use AutoHosting, you could add the following to your mod_mono.conf file to set all content for the server to be served as x-asp-net content: ForceType application/x-asp-net
这样做会产生更广泛的影响,所以我不能说我会推荐它.
Doing so has broader implications, so I can't say I'd recommend it.
如果您能够更改 Apache 服务器的配置,您可能会通过为您的应用程序配置 mod_mono 获得更好的结果.
If you have the ability to change the configuration for the Apache server, you would probably get better results from just configuring mod_mono for your application.
这篇关于Mono 2.4、AutoHosting 和 MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!