IIS 7.5 Express 多重網站

IIS 7.5 Express 支援多重網站嗎? 官方是不支援這樣的設定的。

微軟出的 IIS 7.5 Express 可以讓舊電腦(XP)安裝最新的IIS版本。想把 XP 內建的 IIS 換成 IIS Express 要有些心理準備。它沒有完整的 GUI 設定介面,所有設定都要用文字編輯器修改設定檔。啟動或停止網站服務也都要用命令列指令來完成。不過裝了它可以讓 XP 擁有如同伺服器最新 IIS 版本的所有功能。

還有個缺點,一次只能只能啟動一個網站,即使設了多個也是只能選其中一個來啟動。畢竟它是設計來當開發用的測試環境。還好 IIS Express 內建 URL Rewrite 模組。有了 URL Rewrite 透過一些小技巧就可以把不同目錄模疑成支援多網站的IIS了。

假設有兩個網域 www.aaa.com 及 www.bbb.com 的 IP 都指到這台電腦。如果想讓

  • 連到 http://www.aaa.com/ 連到網站根目錄下的 /www.aaa.com/
  • 連到 http://www.bbb.com/ 連到網站根目錄下的  /www.bbb.com/


可以透過修改網站 web.config 檔 (沒有的話自行建立放置於網站根目錄)
加入 URL Rewrite 的設定如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rewriteMaps>
                <rewriteMap name="site1" />
            </rewriteMaps>
            <rules>
                <rule name="CanonicalHostNameRule1" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_HOST}" pattern="^(.+)$" />
                    </conditions>
                    <action type="Rewrite" url="{C:1}/{R:0}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

如此一來感覺就像同時啟動兩個虛疑網站囉!

有關 IIS Express 的安裝使用就請客位看官請自行 Google 一下吧!

8 個回應:

chenmeinv0 提到...

north face jackets
moncler coats
fitflop shoes
ugg outlet
ray ban outlet
canada goose sale
nike tn pas cher
michael kors outlet
oakley sunglasses outlet
pandora jewelry
2016.10.27xukaimin

chenlina 提到...

gucci outlet
oakley sunglasses
michael kors outlet
longchamp pas cher
oakley sunglasses outlet
adidas yeezy 350
louis vuitton
michael kors outlet
beats by dre
mont blanc mountain pen
chenlina20170109

Unknown 提到...

coach outlet
tiffany outlet
canada goose outlet
michael kors outlet
ed hardy
birkenstocks
air jordan retro
yeezy boost
longchamp uk
cheap oakley sunglasses
20170224caiyan

Unknown 提到...


Heavy kitchen appliances anD pACkeD warDroBe Boxes shoulD Be loaDeD onto the truck last, secureD well for sAFe transportation anD unloaDeD first when the vehicle reAChes its Destination. - شركة نقل عفش بالرياض رخيصة - افضل شركة شراء اثاث مستعمل بالرياض
Disengage the loaDing ramp, close the BACk of the rental truck securely anD Drive sAFely.

SAFety shoulD Be your top priority when loaDing your renteD moving vehicle. Try to always think a few steps aheaD so that your householD gooDs continue to serve you in the same conDition that they left your olD home. افضل شركة نقل اثاث بالمدينة المنورة
تخزين اثاث بالرياض
شركة نقل عفش بجدة
شركة نقل اثاث بينبع

cara menggugurkan hamil 提到...

just information we only provide information for those who need it

Majortotosite Pro 提到...

Excellent goods from you, man. I have understand your stuff previous to and you are just extremely excellent. 토토사이트

Racesite Pro 提到...

I am aware that people like you, are naturally intuitive, resourceful and already have the ability to heal yourself and transform into the person you want to be, you just need assistance to tap into your own resources. 경마

Oncasinosite Net 提到...

I think it should be a good opportunity to get feedback from others who are experienced. 바카라사이트

張貼留言