2015年5月11日 星期一

IIS 設定預先載入

   IIS 8.0有個預載入的功能,這個模組可在IIS啟動網站當時就發出一個要求,驅動應用程式先進行初始化,以加快第一個使用者看到內容的時間。



   除了啟用預先載入外,還必須要到這個網站使用的應用程式集區的進階設定內,設定啟動模式為AlwaysRunning,這樣才會在應用程式啟動時,觸發應用程式的第一個要求。






2015年5月6日 星期三

子應用程式的web.config不受上層web.config的影響

在Google上看了很多前輩的相關文章,都提到要在上層web.comfig加入
<location path="." inheritInChildApplications="false">
    <system.web>
    </system.web>
</location>

但一直無效,最後在一國外網站找到解決,原來<location path="." inheritInChildApplications="false"></location>不是只框住<system.web></system.web>就好,而是要把會影響到子應用程式的區域都框起來。
例如:
<!-- 要遮掉的區域 -->
<location path="." inheritInChildApplications="false">
   <connectionStrings>
   </connectionStrings>
</location>

<!-- 要留的區域 -->
<appSettings>
</appSettings>

<!-- 要遮掉的區域 -->
<location path="." inheritInChildApplications="false">
   <system.web>
        <webParts>
        </webParts>
        <membership>
        </membership>

        <compilation>
        </compilation>
      </system.web>
 </location>


解決方法來源:http://stackoverflow.com/questions/782252/avoid-web-config-inheritance-in-child-web-application-using-inheritinchildapplic


IIS架站CSS無法work

從IIS架好站後發現CSS效果都出不來,最後解決方法是在程式所在資料夾加上USERS的權限,至少需要可讀取和執行。