ssl - IIS 7.5 问题的应用程序初始化模块

标签 ssl initialization iis-7.5

作为利用 IIS 7.5 应用程序初始化模块提高 Web 应用程序初始化速度的概念验证的一部分,我创建了一个简单的 Web 应用程序托管在启用了 SSL 的 IIS 7.5 (Windows Server 2008 R2) 上。请参阅下面的全局和本地设置。

如果我正确理解应用程序初始化模块的工作方式,我希望 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> 

最佳答案

(我知道,这是一个陈旧的问题,但它没有得到解答,而且在我自己的关于该主题的 Google 搜索中出现了。)

请参阅 Microsoft 支持中的以下文章: Application Initialization module fails when web site requires SSL (KB2843964) .引用:

Cause

This behavior is by design.

Resolution

To workaround this limitation, you may consider enabling HTTP (uncheck the "Require SSL" setting in IIS Manager/SSL Settings) and use a URL Rewrite rule to redirect HTTP requests to HTTPS with the exception of the request coming from the warmup module :

 <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 请求”解释为严格意味着非安全请求。

关于ssl - IIS 7.5 问题的应用程序初始化模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13088788/

相关文章:

asp.net - 使用应用程序池标识的 IIS 应用程序丢失主 token ?

Android套接字编程似乎默认使用SSL

django - 如何使用 Django 测试 https 连接,就像使用 'runserver' 测试非 https 连接一样容易?

java - 二维数组的初始化和使用

C++多线程环境下静态变量的初始化

authentication - IIS 7.5 和客户端身份验证

iis-7.5 - IIS 7.5 虚拟目录未授权 : Access is denied due to invalid credentials

javascript - ERR_SSL_VERSION_OR_CIPHER_MISMATCH Node v7.9.0 https

go - 类型错误返回 grpc tls 凭据的接口(interface)

c - 在C中初始化结构内部的数组