Precompile during publish for Azure Web Services
Asked Answered
T

1

16

We are using Azure Web Services (not Web-sites) and run ASP.Net MVC 5.1 application inside it.

When I publish web-sites through Web-deploy, I have an option to "Precompile during publishing":

enter image description here

When I publish to Azure Web Services, I can't find this option anywhere. Any pointers?

The idea is to pre-compile views, so first hit to a view would not be time-penalised by compiling on the fly.

I've looked on Razor Generator but it does not suit our needs. I've seen few other options, but compiling views at publishing stage makes the most sense for our case.

UPD: Just for my reference, I've tried what David Ebbo suggested and it did not work.

Trailblazer answered 25/2, 2014 at 15:36 Comment(3)
Can you try publishing through DropBox?Cis
@AkashKava you can't publish web-services through Dropbox. Dropbox is only for Web-Sites which is different from Web-ServicesTrailblazer
Mr. Downwoter, please explain yourself. What is wrong with the question?Trailblazer
T
9

Calling compiler %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe -m /LM/W3SVC/1273337584/ROOT from command line on the Azure server seems to cause compilation. The Temporary ASP.Net root directory contains one directory this increases in-size and number of files contained within. The site then restarts after compilation. First page open performance then seems much better.

If I run this within a startup script it doesn't work as the site isn't avaible. I guess IIS hasn't started up. Looking at doing something like this Azure: How to execute a startup task delayed?

The site ID doesn't seem to change for different deployments. I guess could get the site id out of IIS and then use that it if it does.

So looks like that does it. Is there are more elegant way? Don't understand why compiling and deploying view files is such a chore.

Topotype answered 28/2, 2014 at 4:4 Comment(1)
I run this in a startup script by just waiting util Get-Website returns something. Then I know that the IIS configurator has done its thing. I'm not 100% sure if it helps, but I also stop IIS while the precompile is in progress.Limes

© 2022 - 2024 — McMap. All rights reserved.