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
Related
I am running a simple ASP.net web application. Chrome is showing the below error after running this.
localhost sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR
but my application is on http, not https.
but the URL is loading with https://localhost:54056/
config is also pointing to http only.
<site name="tan-square" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\Myfolder\OneDrive\Downloads\tan-square" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:54056:localhost" />
</bindings>
</site>
I don't understand where the problem is. Why is it loading with https?
First, check your site web binding detail by the following detail:
Open visual studio, select your project.
right-click on the project and select properties.
under the Web tab and check your project url.
make sure there no such setting in your web.conifg file like below:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Strict-Transport-Security"
value="max-age=16070400; includeSubDomains" />
</customHeaders>
</httpProtocol>
</system.webServer>
When the browser sees this, it will remember, for the given number of seconds, that the current domain should only be contacted over HTTPS. In the future, if the user types http:// or omits the scheme, HTTPS is the default.
Clear your browser cache.
Another thing you could try to find the cause is open chrome and type chrome://net-internals/#hsts in the address bar and search for localhost:
The query shows “localhost” as being in the list of domains in the HSTS set.
The solution is deleting the domain from the cache. type “localhost” into the Delete domain text field, and hit Delete. After doing that when you query for “localhost” again you will receive a “Not found”.
Just create new Virtual Directory:
1-right-click on the project and select properties.
2-under the Web tab change your project url by changing the localhost to http://localhost:48333/ .
3- click Create Virtual Directory.
4- make sure you don't have this in web.config
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Strict-Transport-Security" value="max-age=16070400; includeSubDomains"/>
</customHeaders>
</httpProtocol>
</system.webServer>
If you are running .net core, just run Visual Studio as admin, or go to bin\Debug\netcoreapp3.1 directory, and issue. Wierdly, .net core. .net core surprisingly dont give any error.
%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-3.1.exe --port 5059
change port number to whatever.
Go to launch settings
change the launch URL to https instead of http,
it will ask you to add self generated ssl ,
click Yes and it Run the project.
Hope this will help you
In my case "clearing SSL State" has solved my issue.
Open the Start menu.
Search for and open Internet Options.
In the dialog box that appears, select the Content tab.
Click Clear SSL State.
Change default browser to Chrome and the issue is solved.
I'm using ASP.NET Core RC1 as server to host my Aurelia app. My app was working just fine but the last couple of weeks something changed so that the app does no longer load when hosted on Azure. I'm not sure if it is something I changed or if it's a change on the Azure side but I'm leaning towards the latter.
I've narrowed down the problem quite a bit. The app runs fine locally, with ASP.NET Core Kestrel server and also other servers (e.g. webpack-dev-server). I have continuous deployment setup from Visual Studio Team Services to an Azure Website. The app is published and a web.config is automatically created in my wwwroot:
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%home%\site\approot\web.cmd" arguments="" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout.log"></httpPlatform>
</system.webServer>
</configuration>
Nothing happens when I navigate to my site, e.g. http://demo.azurewebsites.net/. When looking at the console I get a 404. Once I actually got this error but I can't seem to bring it back: 502 - Web server received an invalid response while acting as a gateway or proxy server
I have index.html set as default document but it is not loading. If I enter it explicitly, the app works: http://demo.azurewebsites.net/index.html
If I remove the httpplatformhandler from the web.config, then it works as expected (index.html is loaded automatically). The same happens when I remove the web.config entirely. In these cases the MVC 6 WebAPI behind the scenes does not work at all. I assume that's just logical since I remove the platform handler.
So, why is this httpplatformhandler added? Is it necessary? Why is it created? Is there some setting in the Azure portal that I can adjust to prevent this handler to be configured like this?
I also found this link that seems to suggest that things are changing and that this httpplatformhandler is about to be replaced: Closer Look: Hosting ASP.NET Core on Azure App Service
I'm out on deep water here and any and all help is appreciated.
To get default document support with the static file server middleware you need to use app.UseFileServer() instead of app.UseStaticFiles()
I want to use the auto start facility to ensure my application cache is always populated and ready to go, as described in ScottGu's blog. I'm having some problems with configuring it.
The project has a working title of IceCream, I am using Windows 7, IIS 7.5, ASP.NET 4.5.
In IIS, I have created a new application pool, IceCreamPool, and I have amended applicationHost.config as detailed in the blog posting.
Firstly: I added the startMode to AlwaysRunning on the application pool:
<applicationPools>
...
<add name="IceCreamPool" autoStart="true" managedRuntimeVersion="v4.0" startMode="AlwaysRunning" />
...
</applicationPools>
Next, I added the serviceAutoStartEnabled and the serviceAutoStartProvider to the application:
<application path="/IceCreamCMS" applicationPool="IceCreamPool">
<virtualDirectory path="/" physicalPath="C:\Projects\IceCreamCMS\IceCreamCMS" serviceAutoStartEnabled="true" serviceAutoStartProvider="PreWarmMyCache" />
</application>
Then I added the service auto start provider, just after the <sites> element:
<sites>
...
</sites>
<serviceAutoStartProviders>
<add name="PreWarmMyCache" type="IceCreamCMS.PreWarmCache, IceCreamCMS" />
</serviceAutoStartProviders>
Over in the application, IceCreamCMS, I created the class called PreWarmCache as follows:
using System.Net.Mail;
public class PreWarmCache : System.Web.Hosting.IProcessHostPreloadClient
{
public void Preload(string[] parameters)
{
// Perform initialisation and cache loading logic right here
SmtpClient s = new SmtpClient("webmail.example.com");
s.Send("website#example.com", "me#example.com", "Pre-warming the cache", "Hello there...");
}
}
I then rebuilt the application, but no emails were forthcoming.
I executed an iisreset to see if I got an email then, but the iisreset gave me an error:
The worker process for application pool 'IceCreamPool' encountered an
error 'Configuration file is not well-formed XML ' trying to read
configuration data from file
'\?\C:\inetpub\temp\apppools\IceCreamPool\IceCreamPool.config', line
number '3'. The data field contains the error code.
There applicationHost.config is definitely well formed, I haven't made a basic typo, I ran it through an XML validator to confirm. So, the next obvious place to look would be the config file it states in the error, but it doesn't exist, so I'm guessing since it was in \temp\ it doesn't stick around long enough for me to look at.
I know there's a problem with either my C# bit, or how I've configured the serviceAutoStartProviders, since if I remove the serviceAutoStartProviders section and remove the setting from the <application> element, leaving just the startMode="AlwaysRunning" on the application pool, then I get no problems.
So - any ideas? How do you map your class against the serviceAutoStartProvider? I've tried having my class in no namespace, a namespace which is the name of the application (IceCreamCMS) and a longer namespace; all to no avail.
If anyone's actually got this working, could you share your config and C# code? The original blog post frustratingly doesn't give a final working example!
OK - I just tried out the exact same thing but deployed to a server running Windows Server 2008 and IIS7, and it worked perfectly.
So it must be something about IIS running on Windows 7 - but I'm happy that it's working on a server, so - no worries.
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.
IIS7 Windows 7 64bit
No matter what I do I can't seem to add an application to a web site.
When I 'Test settings' I get "Invalid application path".
Any one have a guess as to what I could be doing wrong?
When I got this error it appeared to be due to a security setting. When I changed the "Connect As" property to an administrator then I no longer got the message.
Obviously this isn't a good solution for a production environment - one should probably grant the least privileges necessary for the user IIS is going to be using by default. I'll update this answer if I learn more.
The error message might be a bug. I ignored it and everything worked for me.
See Here: http://forums.iis.net/t/1177952.aspx
and here http://forums.iis.net/p/1182820/2000936.aspx
I eventually tracked this down to the Anonymous Authentication Credentials. I don't know what had changed, because this application used to work, but anyway, this is what I did:
Click on the Application -> Authentication. Make sure Anonymous Authentication is enabled (it was, in my case), but also click on Edit... and change the anonymous user identity to "Application pool identity" not "Specific user". Making this change worked for me.
Regards.
Go to your HTTP bindings in IIS (select your website, then on the right click on Bindings...).
Delete your SSL and your HTTP binding. Re-Add them.
This usually fixes this for me.
Try : Internet Information Services (IIS) Manager -> Default Web Site -> Click Error Pages properties and select Detail errors
Problem was installing iis manager after .net framework aspnet_regiis had run. Run run aspnet_regiis from x64 .net framework directory
aspnet_regiis -iru // From x64 .net framework directory
IIS Manager can't configure .NET Compilation on .NET 4 Applications
I was also getting this error, I found that it was because I had deleted the Default Application Pool "DefaultAppPool". Re-creating it fixed the problem. Drove me crazy for a few days.
This error will appear if either the web application is mapped to a non-existent app-pool; or if that application pool is stopped.
I also had this error.
My IIS Website has a Default Website with three (3) application directories below it.
I had each of my 3 application directories configured correctly to use .NET Framework v2.0 in the Application Pools.
However, the Default Website never was configured. I didn't think it was necessary since all of my apps were contained within it.
My IIS Server's default configuration is .NET Framework v4.0, so I changed that to .NET v2.0:
After I did that, I no longer received the same error message.
Now, I see this:
I hope this information helps others.
I was also getting this error. The problem for me turned out to be that I had two separate websites on the machine, and I had not designated which address went to which website. To resolve this, go to IIS Manager -> Select Web Site -> Bindings -> Add... -> Enter the host name that you want to resolve for this website. Repeat for any other websites on the machine.
HTH. Rick
I had a similar issue today. It was caused by skype! A recent update to skype had re-enabled port 80 and 443 as alternatives to incoming connections.
H/T : http://www.codeproject.com/Questions/549157/unableplustoplusstartplusdebuggingplusonplustheplu
To disable, go to skype > options > Advanced > Connections and uncheck "Use port 80 and 443 as alternatives to incoming connections"
I still haven’t find a solution, but find a workaround.
You can manually change IIS configuration, in system32\intsrv\config\applicationHost.config. Just manually create (copy-paste) section in <sites> and <location>.
This worked for me. (btw its not recommended.)
For my test app , I created a new application pool and changed its Identity to "NetworkService" .
More about App Pool Identities here
http://www.iis.net/learn/manage/configuring-security/application-pool-identities
and
http://www.iis.net/learn/get-started/planning-for-security/understanding-built-in-user-and-group-accounts-in-iis
You have to make sure that "NetworkService" has rights on your application's physical path.
even it was getting the above error. i found out that IIS was not registered on the server.
registering the iis fixed the issue.
Thanks,
In my case I had virtual dir. When I accessed main WCF Service in main dir it was working fine but accessing WCF service in virtual dir was throwing an error.
I had following code in web.config for both main and virtual dir.
<security>
<requestFiltering>
<denyQueryStringSequences>
<add sequence=".." />
</denyQueryStringSequences>
</requestFiltering>
</security>
by removing from web.config in virtual dir it fixed it.
I was able to correct the flaw by changing the file below:
C:\Windows\System32\inetsrv\config\applicationHost.config
In:
<application path="/" applicationPool="ASP.NET v4.0">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\Bonobo.Git.Server" />
</application>
<application path="/Bonobo.Git.Server" applicationPool="ASP.NET v4.0">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\Bonobo.Git.Server" />
</application>
For:
<application path="/">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\" />
</application>
<application path="/Bonobo.Git.Server" applicationPool="ASP.NET v4.0">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\Bonobo.Git.Server" />
</application>