這篇文章主要介紹“CentOS下怎么實(shí)現(xiàn)Mono和Asp.net”,在日常操作中,相信很多人在CentOS下怎么實(shí)現(xiàn)Mono和Asp.net問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”CentOS下怎么實(shí)現(xiàn)Mono和Asp.net”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!
下載編譯環(huán)境:
yum install gcc bison pkgconfig glib2-devel gettext make httpd-devel gcc-c++ libstdc++-devel
下載并解壓源代碼:
wget
wget
wget
tar -jxvf mono-2.6.3.tar.bz2
tar -jxvf xsp-2.6.3.tar.bz2
tar -jxvf mod_mono-2.6.3.tar.bz2
安裝mono環(huán)境:
cd /root/mydir/mono-2.6.3
./configure --prefix=/opt/mono; make ; make install
echo export pkg_config_path=/opt/mono/lib/pkgconfig:$pkg_config_path>>~/.bash_profile
echo export path=/opt/mono/bin:$path>>~/.bash_profile
source ~/.bash_profile
安裝xsp:
cd /root/mydir/xsp-2.6.3
./configure --prefix=/opt/mono; make ; make install
安裝mod_mono:
先用find / -iname apr*config命令查找出“--with-apr-config=/usr/bin/apr-1-config”(不知道--with-apr-config=/usr/bin/apr-1-config有什么用,好像不要也可以,麻煩知道的告訴一下小弟)
再執(zhí)行下面的命令:
cd /root/mydir/mod_mono-2.6.3
./configure --prefix=/opt/mono --with-mono-prefix=/opt/mono --with-apr-config=/usr/bin/apr-1-config; make ; make install
cp /etc/httpd/conf.d/ /etc/httpd/conf/mod_mono.conf
selinux阻止了httpd對(duì)mod-mono-server的訪問(wèn),所以執(zhí)行下面的語(yǔ)句:
setsebool -p httpd_disable_trans=1
重啟httpd服務(wù)器:
service httpd restart
在防火墻中開(kāi)啟80端口,允許同一個(gè)lan的其他機(jī)器訪問(wèn):
方法1.在不使用圖形界面工具的時(shí)候,通過(guò)關(guān)閉防火墻來(lái)實(shí)現(xiàn)允許開(kāi)放80端口
service iptables stop
(ps:我嘗試過(guò)下面的方法,
vi /etc/sysconfig/iptables
添加:-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 80 -j accept
service iptables restart
雖然在iptables -l中看到http
但無(wú)法從其他機(jī)器訪問(wèn)該服務(wù)器。
如果有誰(shuí)成功,請(qǐng)告知小弟):
方法2.在安裝有圖形界面工具的情況下,用startx進(jìn)入圖形界面,用“security level and firewall”開(kāi)啟80端口。
安裝libgdiplus(xsp的測(cè)試頁(yè)面中,有很多都需要libgdiplus):
yum install httpd build-essential gcc bzip bison pkgconfig glib-devel \
glib2-devel httpd-devel libpng-devel libx11-devel freetype fontconfig \
pango-devel ruby ruby-rdoc gtkhtml38-devel wget
wget
tar -jxvf libgdiplus-2.6.2.tar.bz2
cd /root/mydir/libgdiplus-2.6.2
./configure
make ; make install
echo export ld_library_path=/usr/local/lib/:$ld_library_path >>~/.bash_profile
source ~/.bash_profile
vi /opt/mono/etc/mono/config
添加節(jié)點(diǎn):<dllmap dll="gdiplus.dll" target="/usr/lib/libgdiplus.so.0" />
否則會(huì)出現(xiàn)dllnotfoundexception的異常。
測(cè)試:
一、測(cè)試mono
a.運(yùn)行mono -v輸出:
mono jit compiler version 2.6.3 (tarball fri apr 2 06:13:46 cst 2010)
copyright (c) 2002-2010 novell, inc and contributors.
tls: __thread
gc: included boehm (with typed gc and parallel mark)
sigsegv: altstack
notifications: epoll
architecture: x86
disabled: none
b.運(yùn)行mono-test-install輸出:
active mono: /opt/mono/bin/mono
your have a working system.drawing setup
your file system watcher is: system.io.inotifywatcher
二、測(cè)試asp.net服務(wù)器
a.測(cè)試是否能夠執(zhí)行aspx:
在/var/www/html/目錄下建一個(gè)test.aspx頁(yè)面,內(nèi)容為
<%="hello world!"%>
通過(guò)wget 來(lái)下載該頁(yè)面的內(nèi)容。
b.測(cè)試同一個(gè)lan下其他機(jī)器能否訪問(wèn):
用其他機(jī)器的瀏覽器打開(kāi)
c.跑xsp自帶的測(cè)試程序(多點(diǎn)幾個(gè)頁(yè)面,查看是否會(huì)出現(xiàn)gdiplus.dll dllnotfoundexception的一場(chǎng)):
1.修改apache的配置,開(kāi)放防火墻8080端口
listen 8080
namevirtualhost *:8080
<virtualhost *:8080>
serveradmin
documentroot /var/www/test/
servername local.mydomain.com
errorlog logs/local.mydomain.com-error_log
customlog logs/local.mydomain.com common
</virtualhost>
2.復(fù)制/opt/mono/lib/xsp/test目錄到var/www/下
3.service httpd restart
4.用瀏覽器打開(kāi)
到此,關(guān)于“CentOS下怎么實(shí)現(xiàn)Mono和Asp.net”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!
網(wǎng)站題目:CentOS下怎么實(shí)現(xiàn)Mono和Asp.net-創(chuàng)新互聯(lián)
鏈接分享:http://m.newbst.com/article32/dcsgsc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開(kāi)發(fā)、網(wǎng)站導(dǎo)航、App開(kāi)發(fā)、外貿(mào)建站、定制開(kāi)發(fā)、全網(wǎng)營(yíng)銷(xiāo)推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容