Using ASP.Net Preloader in IIS 7.5 Express - asp.net

Scenario
I am attempting to auto-start/keep-alive/preload information in my ASP.Net application. The instructions are plain and clear: ASP.Net + IIS 7.5 - Preloading & Auto Starting, but I am having problems with doing so in IIS 7.5 Express. I get a 500.19 error regarding some of the config elements. Below is context and question:
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>
Error 1
Error 500.19, Unrecognized element 'serviceautostartproviders'
239: <serviceautostartproviders>
240: <add name="Preload-UserReconciliation" type="ED.Web.ApplicationPreload, ED.Web" />
Error 2 [EDIT]
After shutting down IIS Express entirely, and launching the app from VS again, I get a Visual Studio popup: "Unable to launch the IIS Express Web server."
Question
How do I properly setup IIS Express 7.5 to start the pool, and preload the app using my ApplicationPreload : IProcessHostPreloadClient class?

Embarassing...
http://www.iis.net/download/ApplicationInitialization
I completely missed that this was an out-of-band module for IIS 7.5, not base functionality.
It is included in base functionality beginning with IIS 8.0.
The original post I found with this information on it, did not point that out, and when I used the link referenced in question, I completely breezed over the bright yellow box looking only at the code.

Related

Error 500.19 - Deploy Dot net core api project in IIS

I am working with dot net core 2.1.I am trying to deploy dot net core api application in iis but got following error.
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
I tried to resolve it by installing following hosting bundles but not succeeded.
aspnetcore-runtime-2.2.8-win-x64
dotnet-runtime-2.1.17-win-x64
dotnet-runtime-2.2.8-win-x64
When i click on module section in IIS i got following error.
There was an error while performing this operation.
Filename:\D:\Myproject\Web.config
First issue is related to module section which i resolved by changing module element into web.config file from "AspNetCoreModule" to "AspNetCoreModuleV2".
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
then i face another issue on hosted env. which is related to .net framwork incompatibility.
For above issue i publish my application in self contained mode and issue resolved.
Under IIS open IIS Manager
Click Applications Pools
select Application Pool you are using
click on Advanced Setting on Right Panel of IIS and
Change Identity to LocalSystem
enter image description here

MVC4: Preload application without having access to IIS

I want to have my MVC application to warm up the application after it is being restarted, so the next initial loading will cost almost no time.
The problem is that I do not have the access to the server computer IIS.
I have searched of how to do it, and I found this:
<applicationPools>
<add name="MyAppWorkerProcess" managedRuntimeVersion="v4.0" startMode="AlwaysRunning" />
</applicationPools>
But this code requires access to the server computer.
How can I do it only with my application and web.config?

IIS Application Initialization not Firing into ASP.NET Application

Running on Windows 8, I have enabled the Application Initialization feature of IIS from the Windows Features install options for IIS.
I'm attempting to get an ASP.NET Web app to start up immediately and fire into Application_Start when the Application Pool is restarted. I've followed the instructions from this tutorial, but after setting the values in the ApplicationHost.config, and web.config I see nothing is firing.
Here's what I've set (which seems to match what the article suggests):
<applicationPools>
<add name="MPress" autoStart="true"
enable32BitAppOnWin64="true"
startMode="AlwaysRunning">
<processModel identityType="LocalSystem" setProfileEnvironment="true" />
</applicationPools>
<sites>
<site>
<application path="/MPress.Workflow.WebQueueMessageManager"
applicationPool="MPress" preloadEnabled="true">
<virtualDirectory path="/" physicalPath="C:\Projects2010\Clients\MPress\MarvelPress.Workflow.WebQueueMessageManager" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:" />
</bindings>
</site>
</sites>
And then in the local web.config I have:
<system.webServer>
<applicationInitialization remapManagedRequestsTo="Startup.htm"
skipManagedModules="true"
doAppInitAfterRestart="true">
<add initializationPage="default.aspx" />
</applicationInitialization>
</system.webServer>
Other than the doAppInitAfterRestart flag this matches the settings in the above article exactly except pointing at my virtual app and application pool.
It appears that the Application Pool auto load works - if I stop and restart IIS w3wp I see the application pool show in the task list. But using Process Explorer I can see that the EXE hasn't loaded .NET just sitting there. No .NET Runtime dlls are loaded, so it appears that no request has fired.
What really sucks is that there's no real documentation of section and expected values required for each setting. The doAppInitAfterRestart flag is documented nowhere that I could find. I've also left that out with the same results. I'm also not 100% what the syntax for the URL is. The MSDN article points at "/default.aspx" and I tried that too to no avail.
I also turned on Failed Request Tracing in IIS to see if maybe the fake request fails somehow, but nothing shows up in there. It simply looks like Site Level load is not firing when the application pool restarted.
All of the settings mentioned here are also available through the IIS Admin UI in Windows 8 and everything certainly looks correct.
I'm out of ideas on what else to check or what I might be missing. Any ideas appreciated.
After some more spelunking it turns out that although I had installed the Application Initialization feature using the Windows 8 features, the actual module was not added to the globalModules list.
The following was missing and once added everything started working just fine:
<globalModules>
<add name="ApplicationInitializationModule" image="%windir%\System32\inetsrv\warmup.dll" />
</globalModules>
I faced similar issue but after doing a bit of comparison I found that you need to set Application Pool Managed Pipeline Mode to Integrated. It will not work with Classic Mode

IIS express not working in visual studio 2012

Iam not able to run the Visual Studio Application with IIS Express. Iam getting an Error “Unable to launch IIS Express” for the first time.
After multiple times debugging,
Iam getting the below error,
If I run IIs express manually through command prompt,iam getting the below error,
I have reinstalled IIS Express but there is no change. I have also modified the application host config file of IIs express by deleting all the site names of application but there is no change.
Iam not able to know the issue. So, plz suggest any solution for fixing this issue.
I had the same problem and the problem is related to the app pool definition which you can find in \users{your username}\mydocuments\IISexpress\config\applicationhost.config.
Find the tag
<add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
and change the managedruntimeversion from "v4.0" to "v4.0.30319" for .net 4.5
<add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0.30319" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
Following suggetions that might be helpful to you>>
Use process monitor to watch the iis-express process to see if there are any permission issues when attempting to start it.
For that, follow this link>>
http://msdn.microsoft.com/en-us/library/bb399001%28v=vs.100%29.aspx
If problem is security related then, run visual studio in run as administrator mode
As a last resort, you can disable the logging module by modifying the applicationhost.config, which is located in the %userprofile%\documents\IISexpress\config directory.
To do so you will need to comment out a some lines in the file.
Under the <system.webServer>/<globalModules> element, comment out the line
<add name="HttpLoggingModule" image="%IIS_BIN%\loghttp.dll" />
Under the <location>/<system.webServer>/<modules> element, comment the line
<add name="HttpLoggingModule" lockItem="true" />
After saving your changes try restarting iis express.

Child Application with 2.0 App Pool running under a Site with a 4.0 App Pool

Scenario
I have an IIS Site application built using ASP.Net 4.0, running with its own app v4.0 app pool. Hosted by this site is a child Application built using ASP.Net 2.0, with its own app pool.
<site name="Intranet" id="1" serverAutoStart="true">
<application path="/" applicationPool="Site-Intranet">
<virtualDirectory path="/" physicalPath="D:\sites\intranet" />
</application>
<application path="/ChildApp" applicationPool="App-ChildApp">
<virtualDirectory path="/" physicalPath="D:\apps\childapp" />
</application>
</site>
My first thought is that the 2.0 Application should run using a v2.0 app pool. visiting the URL when doing so causes a server error -- it does not recognize the "targetFramework" attribute in the parent Site's web.config compilation settings.
I understand why, and have found two solutions/workarounds, but I do not fully understand the implications of each one.
Fixes
1. Set Application's app pool as v4.0.
2. Leave the Application's app pool as v2.0, but change the parent Site's web.config to break inheritance on the <compilation> section:
<location path="." inheritInChildApplications="false">
<system.web>
<compilation targetFramework="4.0" debug="true" />
</system.web>
</location>
Question(s):
What's really going on with these fixes/solutions?
In scenario #1, is the 2.0 Application being compiled/run by the 4.0 CLR? Assuming so, is the CLR attempting to run it as a 2.0 app (i.e. backwards compatibility)? Or is it simply assuming it is a 4.0 web app (seems dangerous)?
In scenario #2, I know we have stopped the child app from seeing the targetFramework attribute, but is the 2.0 CLR truly compiling/running the application? If so, is this all that is needed to safely run an ASP.Net 2.0 application under an ASP.Net 4.0 site?
I have used scenario #2 many times and never had any problems. So yes this is all that is needed to safely run an ASP.Net 2.0 application under an ASP.Net 4.0 site.
Although no one can answer that your two applications will definitely work together this way. Probably best to do a full system test and if you do find any specific problems post a new question.

Resources