Как всегда сохранять мое приложение ASP.NET “живым”, и если это - плохая идея, почему я не должен делать этого?

const countOffs = $('span.clsCatOffCount');
countOffs.each((idx, el) => {
  const content = el.innerHTML;
  el.innerHTML = content.replace(/\(|\)/g, '')
});

Или просто используйте ответ Тайлера с заменой регулярного выражения выше

8
задан Community 23 May 2017 в 12:02
поделиться

3 ответа

IIS also shuts down your web app after a given time period, depending on its configuration. I'm not as familiar with IIS7 and where to configure this, so you might want to do a little research on how to configure this (starting point?).

Is it bad? Depends on how good your code is. If you're not leaking memory or resources, probably not.

The other solution is to precompile your website. This might be the better option for you. You'll have to check it out and see, however, as it may come with a downside, depending on how you interact with your website.

4
ответ дан 5 December 2019 в 21:21
поделиться

My understanding of ASP.NET was that IIS (7.0, in this case), compiles a web application the first time it is ever run, and then caches those binaries until such a time as the web application is changed. Is my understanding incorrect?

That is correct. Specifically, the assemblies are built as shadow copies (not to be confused with the volume snapshot service / shadow copy feature). This enables you to replace the code in the folder on the fly without affecting existing running sessions. ASP.NET will detect the change, and compile new versions into the target directory (typically Temporary ASP.NET Files). More on that process: Understanding ASP.NET Dynamic Compilation

2
ответ дан 5 December 2019 в 21:21
поделиться

If its purely the compilation time then often the most efficient approach is to hit the website yourself after the recycle. Make a call at regular intervals to ensure that it is you who receives the 15 second delay not your client.

I would be surprised if that is all compilation time however (depending on hardware) - do you have a lot of static instances of classes? Do they do a lot of work on start-up?

Either with tracing or profiling you could probably quite quickly work out where the start-up time was spent.

As to why keeping a process around is a bad idea, I believe its due to clear-up. No matter how well we look after our data or how well behaved the GC is, there is a good clear-up performed by restarting the process. Things like fragmentation can go away and any other resource issues that build up over time are cleared down. Therefore it is quite a bad idea to keep a server process running indefinitely.

1
ответ дан 5 December 2019 в 21:21
поделиться
Другие вопросы по тегам:

Похожие вопросы: