jmw jmw - 1 year ago 107
ASP.NET (C#) Question

aspnet_compiler in Azure starup task

Does anyone know if its possible to call aspnet_compiler from an azure role startup task to force a precompilation inplace. (And if so as a foregroudn/background or simple task?)

Perhaps something like:
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_precompile.exe -v / -p "F:\siteroot\0"

Or are there any better ways to accomplish this?

Answer Source

Yes, that should work once you figure out the right path to the compiler although I haven't tried this specific approach.

An alternative I've tried is to use ClientBuildManager.PrecompileApplication as described in this answer. I tried calling that from inside OnStart() but you can compile C# code as a .NET assembly and use that from PowerShell or just call .NET primitives from PowerShell as described here and that way call it from the startup task.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download