在IIS 7.5 Express中使用ASP.Net预加载程序

3

场景

我试图在我的ASP.Net应用程序中实现自动启动/保持活动/预加载信息。指示非常明确:ASP.Net + IIS 7.5 - 预加载和自动启动,但我在IIS 7.5 Express中无法做到这一点。我遇到了一些关于配置元素的500.19错误。下面是上下文和问题:

ApplicationHost.config

<!-- Inside the ApplicationPools element we tell the appropriate app pool 
     to auto start and always run. -->
<add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" startMode="AlwaysRunning" />

<!-- In the Sites element we first ensure our application is using the correct 
     app pool. Then we tell it to use the pools auto start functionality, and 
     point it towards a provider to use. -->
<site name="ED.Web" id="11">
    <application path="/" applicationPool="Clr4IntegratedAppPool" serviceAutoStartEnabled="true" serviceAutoStartProvider="Preload-UserReconciliation">
    <!-- everything is properly closed -->


<!-- Just before closing the Sites element we declare a provider; it identifies 
     the class within a particular assembly that should be used for preloading -->
    <serviceautostartproviders>
        <add name="Preload-UserReconciliation" type="ED.Web.ApplicationPreload, ED.Web" />
</serviceautostartproviders>
</sites>

错误1

错误500.19,未识别的元素'serviceautostartproviders'

239:    <serviceautostartproviders>
240:        <add name="Preload-UserReconciliation" type="ED.Web.ApplicationPreload, ED.Web" />

错误 2 [编辑]

在完全关闭IIS Express后,再次从VS启动应用程序时,会弹出一个Visual Studio弹窗:"无法启动IIS Express Web服务器。"

问题

我如何正确设置IIS Express 7.5以启动池,并使用我的ApplicationPreload:IProcessHostPreloadClient类预加载应用程序?


你的代码片段中没有看到开头的<sites>标签吗?可能性不大,但有时候简单的事情会被忽略…… :) 实际上,整个<sites>块难道不应该在<serviceautostartproviders>部分之前吗?看起来它们可能在你的示例中嵌套了。 - David W
谢谢回复。评论中解释了这些特定元素的位置。XML结构是100%正确的(至少与ASP.Net上的说明相匹配):) - one.beat.consumer
够好了,我只是在看那里的一个样本,其中两个是分开的,而在你的片段中看到了嵌套的部分... - David W
检查答案。我应该被程序员修女责骂。 - one.beat.consumer
LOL 很容易被忽略。我自己也没有注意到 :) - David W
1个回答

2
尴尬... http://www.iis.net/download/ApplicationInitialization
我完全没注意到这是IIS 7.5的一个独立模块,而不是基本功能。 从IIS 8.0开始,它已经包含在基本功能中。
原始帖子没有指出这一点,当我使用问题中引用的链接时,我完全忽略了明亮的黄色框,只看了代码。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接