Microsoft .net Framework 3.5 Service Pack

0 views
Skip to first unread message

Tammara Freimark

unread,
Aug 3, 2024, 2:46:57 PM8/3/24
to ealpodlade

We have experienced this situation with every version of the .Net framework ever installed - it turns out the NGEN service is the Native image GENerator, not Next Gen or something else I thought it was for a while.

At any rate, what is happening is quite annoying, but it is not suspicious nor is it malware, a bug, or harming your computer. The logs you posted indicate that the service is PRE compiling the .Net framework and it shuts down the service as soon as it's done. However, as an experienced C, C++, C#, Objective-C, etc. developer for 20+ years...I'm not sure why Microsoft has it install with an "automatic" startup type. Additionally, I'm not sure why the compilation needs to ever run more than once (except should a patch come out or something). But, I'm not privy to those answers...so, I'll stick to only advice about what I have found helps!

That way, Windows Service Manager will start it when necessary but it will not attempt to needlessly start (and then stop) all the time. This should alleviate some of the log-spew for you. It has completely eliminated the warning about the services not running for us on over 100 Windows Servers and 200 Client Workstations. HOWEVER, please do not perform this change unless you are doing so on a non-production computer or are certain it will not have any adverse effects.

I just installed the .NET 4.0 framework and see Microsoft .NET Framework NGEN v4.0.30319_x64 listed in services.msc. It is set for Automatic-Delayed Start. However, it is in a stopped state and when I try to start the service I get the message:

This is a service that is started and stop "as-needed" by the ngen (Native Image Generator) executable. According to this MSDN page, the service typically starts in conjunction with a installation program (installer) or by direct interaction with the ngen executable.

NGEN stands for "Native Image Generation". It is a tool that improves the performance of managed applications. For your concern, I would suggest you to read the following two helpful links to understand NGEN:

NGen refers to the process of precompiling Microsoft intermediate language (MSIL) executables into machine code prior to execution time. This results in two primary performance benefits. First, it reduces application startup time by avoiding the need to compile code at run time. Second, it improves memory usage by allowing for code pages to be shared across multiple processes.

The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead of using the just-in-time (JIT) compiler to compile the original assembly.

This tool is automatically installed with Visual Studio and with the Windows SDK. To run the tool, we recommend that you use the Visual Studio Command Prompt or the Windows SDK Command Prompt (CMD Shell). These utilities enable you to run the tool easily, without navigating to the installation folder.

I noticed that you have tried the Verification Tool to check the installation of .NET Framework 4.0 on your machine. What's the result? You can find the verification result from "Current Status" after you run the tool.

I've had this issue when trying to install SS 2016. There are a few other blog posts that cover this process, but they all assume that you have the appropriate ISO file. I have an MSDN license, but have not been able to find an ISO online. Where does one get the appropriate ISO file?

1. .Net framework 4 and above are standalone frameworks so they do not contain the updates of their older version like 3.5. So even if .Net 4.5 is present on a Windows 8 or Windows Server 2012 machine you still have to install/ enable .Net Framework 3.5.

2. As CozzaroNero mentioned some of the tools/ services in SQL 2012/2014/2016 still require .Net 3.5. In addition if you will notice after the installation of SQL server 2012 a folder of SQL server 2008 is also created in All programs which has Configuration Tools -> Installation Center in it. These tools being from SQL server 2008 still require .Net 3.5

3. Microsoft's decision to have .Net 3.5 not preinstalled/enabled on newer OS's like Windows 8 or Windows server 2012 or else providing the setup of .net 3.5 as a part of the SQL server setup itself( as it was in SQL server 2008 setup).

Anyways, as a solution I always keep a set of pre-installation scripts that check if .Net 3.5 is installed or not and in case not then it installs it either using DISM.exe in CommandShell or Install-WindowsFeature in PowerShell.

It's no problem to install .Net after the fact usually EXCEPT if the OS has had service packs applied. At that point the 'Provide alternative sources' pointing to the SxS folder doesn't work because the installed binaries have changed in some way.

The other thing that might be worth mentioning (because I didn't know!) was that the .iso has to be mounted as a virtual CD/DVD drive (assuming you're on a VM) - you can't just copy it to a folder and point dism at it.

May the road rise up to meet you. May the wind always be at your back. May the sun shine warm upon your face,and rains fall soft upon your fields. And until we meet again, May your God hold you in the palm of His hand.

The .NET Framework 4.5 and its point releases are backward-compatible with apps that were built with earlier versions of the .NET Framework. In other words, apps and components built with previous versions will work without modification on the .NET Framework 4.5 However, by default, apps run on the version of the common language runtime for which they were developed, so you may have to provide a configuration file to enable your app to run on the .NET Framework 4. All this means more work and testing for sql dba that have to test more in details all applications and assemblies... , if the problem is with an application, you will need to find some dev resources to try to fix this issues and so on... all of the sudden, upgrading to a new version of sql became a nightmare or at least not that easy, innit?

"In practice, this compatibility can be broken by seemingly inconsequential changes in the .NET Framework and changes in programming techniques. For example, performance improvements in the .NET Framework 4 can expose a race condition that did not occur on earlier versions. Similarly, using a hard-coded path to .NET Framework assemblies, performing an equality comparison with a particular version of the .NET Framework, and getting the value of a private field by using reflection are not backward-compatible practices. In addition, each version of the .NET Framework includes bug fixes and security-related changes that can affect the compatibility of some apps and components."

Note. Assemblies are DLL files used in an instance of SQL Server to deploy functions, stored procedures, triggers, user-defined aggregates, and user-defined types that are written in one of the managed code languages hosted by the Microsoft .NET Framework common language runtime (CLR), instead of in Transact-SQL.

If you're using a virtual environment then you can include this framework into your OS template, alternatively if using a deployment service (e.g. PXE Boot) then you could add this into the post-deployment scripts.

I've studied Windows Services and .Net framework.From my research, a windows service is a type of application that is primarily used to run in background and can be done automatically or periodically. And .Net is a software framework developed by Microsoft that runs primarily on Microsoft Windows.

What I would like to know where in the stack of the .Net framework are basically the windows services, supposing windows services use .Net framework.Any further exaplanation on the relation between these two will be a great help.

They are two completely separate notions. They're related in the way that, for example, a hotel janitorial staff might be related to a guest of the hotel. Just because they reside in the same "building" at some point, doesn't mean there is any "useful" (i.e. substantive for the purposes of comparison given the context) relationship between them, though their paths may cross for whatever reason. The same goes for the notion of windows services and the .NET framework.

A service does not have to be written in .NET, anything will do. Two basic things need to happen. First of all, the Service Manager built into Windows needs to know that the service exists. That requires writing a handful of registry keys. Bare essentials are the service name, where the EXE is located and how it should be started. The ServiceInstaller class you write takes care of that, you run InstallUtil.exe to let that installer do its job. Have a look-see with Regedit.exe, navigate to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services key.

And then the program needs to use a winapi function to talk to the service manager. So that the manager can deliver notifications that tell service to start, stop, pause, etc. That's wrapped by the ServiceBase class, you get friendly methods you can override. Like OnStart(), etc.

You can write a Windows Service in many programming languages. You can write a Windows Service in .NET and a language making use of it (C#, VB.NET, etc) but that is not required. You can also use other languages that do not use the .NET framework to write a Windows Service.

@Yoann same issue here. Clean install of Windows Server 2019 latest build, install .NET Framework offline installer 4.8, reboot and boom. Many native control panels, like Server Manager, requesting some 4.0.... version of .NET framework instead, failing to load.

I had the same issue and received zero help or support from Microsoft. Dell support googled and read back to me everything I had googled and tried already. Importing the above registry information fixed it without a reboot.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages