2012-10-26 71 views
7

作爲使用IIS 7.5的應用程序初始化模塊提高Web應用程序初始化速度的概念驗證的一部分,我創建了一個託管在IIS 7.5(Windows Server 2008 R2 )啓用SSL。請參閱下面的全球和本地設置。IIS 7.5問題的應用程序初始化模塊

如果我正確理解應用程序初始化模塊的工作方式,我期待IIS向appinit.aspx(https://localhost/alwaysrunning/appinit.aspx)發出請求以初始化Web應用程序。然而這從來沒有發生過。

任何想法?

屬性initializationPage的用途是什麼?

任何幫助,這將不勝感激。

編輯:當我禁用SSL時,應用程序初始化模塊按預期向appinit.aspx發出請求。不過,我需要使用SSL啓用此功能。

applicationHost.config文件中的

全局設置:

<add name="appinit" autoStart="true" startMode="AlwaysRunning"> 
    <recycling logEventOnRecycle="Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory"> 
     <periodicRestart requests="0" time="00:05:00"> 
      <schedule> 
       <clear /> 
      </schedule> 
     </periodicRestart> 
    </recycling> 
    <processModel identityType="NetworkService" idleTimeout="00:00:00" /> 
</add> 

<application path="/alwaysrunning" preloadEnabled="true" applicationPool="appinit"> 
    <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\alwaysrunnig" /> 
</application> 
在應用程序的web.config文件

本地設置:

<applicationInitialization remapManagedRequestsTo="splashscreen.htm" skipManagedModules="true" > 
    <add initializationPage="/appinit.aspx" /> 
</applicationInitialization> 

回答

4

(我知道,陳舊的問題,但它是沒有回答的&出現在我自己的Googl e搜索該主題。)

請參閱以下Microsoft支持文章: Application Initialization module fails when web site requires SSL (KB2843964)。報價:

原因

此行爲是由設計。

分辨率

要解除此限制,可以考慮啓用HTTP(取消 「要求SSL」在IIS管理器中設置/ SSL設置),並使用URL 重寫規則的HTTP請求重定向到HTTPS與 異常的請求,從熱身模塊來:

<rewrite> 
    <rules> 
    <rule name="No redirect on warmup request (request from localhost with warmup user agent)" stopProcessing="true"> 
     <match url=".*" /> 
     <conditions> 
     <add input="{HTTP_HOST}" pattern="localhost" /> 
     <add input="{HTTP_USER_AGENT}" pattern="Initialization" /> 
     </conditions> 
     <action type="Rewrite" url="{URL}" /> 
    </rule> 
    <rule name="HTTP to HTTPS redirect for all requests" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions> 
     <add input="{HTTPS}" pattern="off" /> 
     </conditions> 
     <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" /> 
    </rule> 
    </rules> 
</rewrite> 

愛是愛「此行爲是設計。」感嘆。令人遺憾的是,我發現有關此應用程序初始化功能的頂級搜索結果未能提及此限制—,除非將「HTTP請求」解釋爲嚴格意味着非安全請求。

+1

謝謝,這節省了我很多的挫折! –

+0

@AaronD不客氣。很高興幫助別人! –

+0

@ ChrisW.Rea這是多麼聰明的想法。謝謝! – UncleZen

相關問題