IIS Precache App Pool Events - html

We have a pretty large asp.net LOB web application. The problem is that every time the app pool is started (whether its the first time, or if the app pool is recycled) it's takes up to 10 seconds or more to spin up and hit the first page. This leaves you in a state of looking at a white page and a loading spinner until IIS is ready to serve up the page. This isnt the end of the world because it's only normally a one off thing and only the first person experiences this. I'm just wondering if there is an event that we can hook into to serve up a page and show the user some type of simple splash screen to give them some type of feedback instead of a loading state.
Has anybody got any ideas on how to hook this into IIS/asp.net?

You can use the application initialization module. If you run IIS 8.0 or higher it is built-in, if you run IIS 7.5 you can download and install it.
Hopefully you are running .NET 4.5. Set the application start mode to AlwaysRunning. Then enable preload.
And then here you will want to add this to your web.config in your system.WebServer section
<applicationInitialization remapManagedRequestsTo="Startup.htm" skipManagedModules="true" >
<add initializationPage="/default.aspx" />
</applicationInitialization>
The startup.htm is your default loading screen. If anyone tries to access it when they go to the web application it will be remapped to that. Just add a simple JavaScript refresh location script to it.
This link should give you everything you need. Again, I am assuming you are on a newer version of ASP.NET and IIS.
http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization

Related

Google Web Designer has a very long load time

I'm creating an html5 banner using Google Web Designer. I've created the banner and published it. When I view the published version I noticed that it takes sometime to load.
Someone else on my team is also creating HTML5 banners. The banner that he creates loads instantly even though its a larger file size. We compared our files and other than the actual assets, the way the banner was created and published is the same.
Does anyone have any ideas why this might be happening?
GWD add this code at the end of the banner and animation show up immediately:
<script data-exports-type="dclk-quick-preview">studio.Enabler.setRushSimulatedLocalEvents(true);</script>
Which environment are you using?
When creating a new project in GWD you are able to select an environment. By default is DoubleClick.
This adds additional file (in the case of DoubleClick, the Enabler library).
If you open your Chrome console, while running the banner, you will see that the banner is not initialized until the enabler is available.
You will also see how much time it takes to load the enabler.
If your colleague is creating a banner without that library, or without correctly listening to the event Enabler.initialized, this may be the main reason for the discrepancy.
If you don't want to include this additional library (that is used to integrate your banner in DoubleClick Studio), just select Generic from the environments dropdown.
There is also another reason that may cause the delay, and is the PoliteLoader.
You can select to politeLoad the banner from the Publish menu.
If the PoliteLoader is selected this cause the banner to be initialized only after the page is fully loaded. This may cause delays compared to a non polite loaded ads.
This all seems not to be a bug, but a feature of enabler.js simulates a test environment, when not beeing uploaded to Adwords (guess it similar in Doubleclick). Uploading to Google Environments should change the situation
Look at the console and see:
There is a long delay in alle items loading after the enabler.js.
It is NOT because of a long loading time of enabler.js - thats all fine.
Looking at the Logs, the enabler waits a second and throws out:
[ 1.008s] [studio.sdk] Using default ad parameters in test environment. Simulating local events.
When uploading to Google Adwords (i assume that this all is similar to DC Studio) - the enabler throws out different logs and the delay disappears.
Hope this was helpful.
By chance, I found out a way to make the Enabler loading fast. Instead of using Publish, use Preview to generate the HTML.
For some reasons, Enabler.js in preview-generated HTML only takes 0.019s to load as compared to Enabler.js in publish-generated HTML taking 1.015s to load.
Studio Enabler SDK looks for "e" parameter in iframe URL containing Studio creative. It expects a number and uses that to set the creative environment.
Setting e=1 in your preview environment (query string parameter in the iframe url pointing at the index.html for your studio creative) will tell Enabler to use LIVE mode.
I assume there is a reason why Enabler has this functionality (avoid counting impressions or paying for impressions from test/qa environment)...so I wouldn't suggest using this as a permanent setting.

Chrome HTTP2.0 throws SPDY PROTOCOL ERROR

I'm using Windows 10 Technical preview. I know it's not yet tweeked out to full usage, but here is my problem.
On local IIS I'm developing my web app. It loads most of the data via ASP.NET MVC API. After the upgrade to Windows 10 I started to get
net::ERR_SPDY_PROTOCOL_ERROR
for all AJAX calls to API. The HTML page loads normally, but the dynamic loading of data content fails. I managed to figure it out by starting Chrome with parameters
--use-spdy=off --use-system-ssl
Strange thing is that on the first start I always get this error and have to restart Chrome. Other browsers fail too, but not with specific error. For the transfer there is used HTTP2.0 protocol, which is based on SPDY protocol.
Do I have to turn something off in IIS?
Edit:
Seems like an IIS problem with HTTP2.0. When trying to enter the site from Windows 8.1 I get the same error.
Most people’s reaction to this error would be to reload the web page. We would actually recommend this as a first response. Sometimes this even does work.
Interesting Factoid: SPDY actually stands for “speedy” and is used to reduce a web pages’ load time
If reloading the web pages does not remove the error, then you should close down Google Chrome and restart it. This alone will not really solve the problem because you will need to clear the cache as soon as you restart the browser.
or in cmd clear dns using this command ipconfig/flushdns

Exception on Hosting.WebApp.Start()

I'm debugging a project where Microsoft.Owin.Hosting.WebApp class is used. This is a legacy code. At the same time the whole project is hosted inside IIS web application. When app pool is recycled, I'm receiving a massive exception eruption into the log file, and it says that "Exception has been thrown by the target of an invocation."
The line it points is no more than
App = WebApp.Start(url);
This problem occurs only on recycling. When I manually stop the pool and start it after a couple of seconds, it works well (until next recycle). I'm pretty sure the problem is that WebApp class is trying to register itself onto a port (defined by the url parameter) that is still registered after WebApp's previous instance (so that, for example, recycling without interruption of service is not possible).
Is there any way to check if port is already registered? To make it free?
The WebApp class is from Microsoft.Owin.Hosting. You'd only use that when self-hosting. It does not make sense to have that in an web app running in IIS.
The way Owin/Katana starts when using IIS as a host is through a PreApplicationStartAttribute. Using it, a Module is added that calls the Owin/Katana initialization code (finds Startup.cs, runs configuration, etc).
The dll that does this is Microsoft.Owin.Host.SystemWeb.
(I have no reference for this, I had to ask the source)
In short, if you are running in IIS, you should use the Microsot.Owin.Host.SystemWeb nuget package. You should be able to remove that line: App = WebApp.Start.

Phpstorm 7 reload in browser / live edit - how to use it with php files

I've done the tutorials on how to setup Phpstorm to use live edit, and I started using the "Reload in browser" functionality, but in version 7 it reloads only that single url which i've set up at in the Debug configuration.
My problem is that before, in version 6 as I remeber, it automatically reloaded every single page that was opened in the browser, and was related to the domain I had in Debug configuration URL. (So if I had www.mysite.local set up in PHP Web aplication debug configuration, it also reloaded www.mysite.local/something, www.mysite.local/backoffice..), but not anymore in v7.
Does anybody know if it is still possible in the new version, so I don't have to make a configuration for every single page?
Thx
For now creating confifuration for each page seems to be necessary. Please vote for WEB-10165

Accessing the dashboard in blogengine.net tries to download cshtml file instead of loading the page

I have recently installed the blogengine.net application on both my local test server and my live web server. They are both Windows Server 2003 with IIS6. The application works fine on my local test server but it works partially on the live server. When I try to access the dashboard in the settings section, instead of loading the page, the browser tries to download the page. And when I click on themes (another cshtml page) I get a lot of strange text starting with #using BlogEngine.Core.Packaging #{ Page.Title = Resources.labels.themes;.....etc
I have been googling a lot but most answers seem to focus on IIS7 and the ones that seemed to apply for IIS6 did not seem to apply since they mentioned checking for missing DLLs (which isn't the case since the bin folder contains the exact same files as the one in the working server).
Things I have tried:
1) Resintalling the blog engine
2) Install MVC 3
3) Adding a mime type "text/html" to the ".cshtml" extension under the HTTP Headers tab in the web site properties (in IIS6)
4) Adding a dedicated application pool for the website
Some of the suggestions I found suggested that I should set the application pool to use .Net 4, but I don't know how to set that in IIS6 (unlike IIS7.5) and I set the asp.net setting in the website properties to 4.
Any help or pointers would be greatly appreciated.
Thanks!
OK. It appears that the problem has now been solved. For the benefit of other people having the same problem, here is how to do it:
1) In IIS Manager, go to website > properties > Home Directory > Configuration
2) Add two application extensions for .cshtml and .cshtm, setting both to:
executable = c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll
limit to = GET,HEAD,POST,DEBUG
Note that after doing this I was still having the problems with the browser trying to download the files rather then loading the pages. This was solved by clearing the browser cache (was using Chrome).