Last post Oct 04, 2019 01:05 PM by PatriceSc
Oct 03, 2019 03:52 PM|Gatwick|LINK
For my web application I need to provide the response right after deployment as fast as it possible. To achieve this goal I would like to add NGEN to my publish configuration. How can I do it via Visual Studio or by manual editing of all involved .CSPROJ
Oct 03, 2019 05:10 PM|PatriceSc|LINK
I would perhaps try first few IIS settings if not done yet such as
Oct 03, 2019 08:28 PM|Gatwick|LINK
Tried this , didn't help too much. I still need to find a way of running NGEN while publishing my app. Any ideas?
Oct 04, 2019 02:26 AM|Brando ZWZ|LINK
If you want to know how to run command after the web application has published successfully.
I suggest you could consider adding below config into the csproj.
<Target Name="CustomPostPublishActions" AfterTargets="GatherAllFilesToPublish">
<Message Text="This is custom target" Importance="high" />
<Exec Command='yourcommand line codes'/>
Oct 04, 2019 10:37 AM|Gatwick|LINK
Ok, in this case the next step comes down to these
yourcommand line codes
Do you have any ideas what I should write there? I want to avoid explicit mentioning of all produced DLLs.
Oct 04, 2019 11:18 AM|PatriceSc|LINK
You could first start by hand and run ngen for all files found in your bin folder and see then, what happens. Most sources seems to tell it is not that significant.
I would start first to check what happens. If I remember you have "health checks" for that. Also I believe you can ask for launching the site once dpeloyed at least from VS.
Also it happens the time is spent in user code depending on what you are doing when the app starts...
Oct 04, 2019 01:05 PM|PatriceSc|LINK
ngen is described here: https://docs.microsoft.com/en-us/dotnet/framework/tools/ngen-exe-native-image-generator
For now you could just try this manually in your bin folder but accordng to https://www.eidias.com/blog/2017/1/4/does-it-make-sense-to-ngen-compile-your-aspnet-mvc-application it
doesn't seems to make a significant difference.
I would look more closely at what happens for example you can still have a compilation step (even for a "precompiled app", you can still have some stuff being precompiled on the fly). If I remember you have "ASP.NET Health" events allowing to cach this kind
Sometimes it turns out just to be something being done explictely in the code and that is forgotten (loading images in a cache or whatever rather than waiting for the first use).