现在的位置: 首页 > 综合 > 正文

Freebsd ports 安装apache+mod_mono+mono运行.net4.0

2013年07月26日 ⁄ 综合 ⁄ 共 3839字 ⁄ 字号 评论关闭

参考文档:在Linux上部署aspnet mvc3

折腾了好久,终于可以在Freebsd下运行.net4.0应用程序了。

安装环境是在Freebsd 9.0 rc,一路都是使用PORTS安装,在安装之前首先更新Ports,portsnap fetch extract这个只是在第一次的时候运行,以后更新就直接portsnap update.

那么就开始安装Apache,mono,mod_mono,xsp其实在安装mod_mono的时候就会关联安装xsp,一直安装下去都没问题,期间mono可能有警告信息不用理。

如果使用ports安装安装完了之后就只需要把apache加到开机启动(echo 'apache22_enable="YES" >> /etc/rc.conf),然后启动Apache service apache22 start.

我们在把xsp(默认路径:/usr/local/lib/xsp/test)下的测试程序拷贝apache(默认路径:/usr/local/www/apache22/data)的运行目录下,然后我们到在浏览器输入地址就可以访问了。

上面的安装配置都很顺利,但是mod_mono默认开启的mod-mono-server2只能运行.net 2.0,查看了一些文档,原来是要在mod_mono.conf(默认路径:/usr/local/etc/apache22/Includes)加入MonoServerPath "/usr/local/bin/mod-mono-server4"和MonoApplication enabled这两个东西。

到这里我以为就可以但是问题来了,在页面访问出现500错误,查看了apche的错误日志

[Tue Jan 15 10:27:01 2013] [notice] Apache/2.2.23 (FreeBSD) mod_mono/2.10 mod_ssl/2.2.23 OpenSSL/0.9.8q DAV/2 configured -- resuming normal operations
Exception caught during reading the configuration file:
System.MissingMethodException: Method not found: 'System.Configuration.IConfigurationSectionHandler.Create'.
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0 
  at Mono.WebServer.Apache.Server.get_AppSettings () [0x00001] in /usr/ports/www/xsp/work/xsp-2.10.2/src/Mono.WebServer.Apache/main.cs:208 
  at Mono.WebServer.Apache.Server+ApplicationSettings..ctor () [0x0002a] in /usr/ports/www/xsp/work/xsp-2.10.2/src/Mono.WebServer.Apache/main.cs:63 
mod-mono-server4
Listening on: /tmp/mod_mono_server_global
Root directory: /usr/local/www/apache22/data/data
Worker initialization exception occurred. Continuing anyway:
System.MissingMethodException: Method not found: 'System.Configuration.IConfigurationSectionHandler.Create'.
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0 
  at Mono.WebServer.ModMonoWorkerRequest..cctor () [0x00034] in /usr/ports/www/xsp/work/xsp-2.10.2/src/Mono.WebServer.Apache/ModMonoWorkerRequest.cs:85 
System.NullReferenceException: Object reference not set to an instance of an object
  at Mono.WebServer.BaseApplicationHost.EndOfRequest (Mono.WebServer.MonoWorkerRequest mwr) [0x00029] in /usr/ports/www/xsp/work/xsp-2.10.2/src/Mono.WebServer/BaseApplicationHost.cs:141 
  at Mono.WebServer.ModMonoApplicationHost.ProcessRequest (Int32 reqId, System.String verb, System.String queryString, System.String path, System.String protocol, System.String localAddress, Int32 serverPort, System.String remoteAddress, Int32 remotePort, System.String remoteName, System.String[] headers, System.String[] headerValues, System.Object worker) [0x00173] in /usr/ports/www/xsp/work/xsp-2.10.2/src/Mono.WebServer.Apache/ModMonoApplicationHost.cs:109 
  at (wrapper remoting-invoke-with-check) Mono.WebServer.ModMonoApplicationHost:ProcessRequest (int,string,string,string,string,string,int,string,int,string,string[],string[],object)
  at Mono.WebServer.ModMonoWorker.InnerRun (System.Object state) [0x00199] in /usr/ports/www/xsp/work/xsp-2.10.2/src/Mono.WebServer.Apache/ModMonoWorker.cs:239 
  at Mono.WebServer.ModMonoWorker.Run (System.Object state) [0x00002] in /usr/ports/www/xsp/work/xsp-2.10.2/src/Mono.WebServer.Apache/ModMonoWorker.cs:92 
[Tue Jan 15 10:27:07 2013] [error] (70014)End of file found: read_data failed
[Tue Jan 15 10:27:07 2013] [error] Command stream corrupted, last command was -1

解决办法就是需要到https://github.com/mono/xsp下载xsp-master然后编译安装就可以了....

最后测试OK.....测试地址http://hosily.dlinkddns.com:9089/index.aspx

参考wang_yb--在Linux上部署aspnet mvc3

抱歉!评论已关闭.