An application domain is a logical container in a single process. Application domains can host multiple assemblies, and they are preventing these assemblies to access the memory of assemblies belonging to other application domains. Even better, when an unhandled exception occurs in a given application domain, that won’t affect the other application domains.
But the benefits aren’t over yet. You can assign different security access levels to each application domain in a given process. Be aware of that when your application runs with full trust, application domains cannot guarantee security, because they can easily bypassed then.
The best example for an application domain ASP.NET. You can assign all of your web sites to a single process (w3wp.exe), and each website will run within its own application domain, isolating themselves from the others.
A Windows Service is a process without a user interface, that runs constantly in the background in its own session. This said, hit CTRL+ALT+DEL, select the Task Manager, then the Services pane, and hit the Services button. First ensure that you are using Windows, then that you have administrative rights. What you will see are the Windows Services. Friend with them, they are not malevolent.
Now that we know what is exactly a Windows Service, let’s try to create one. There are two ways to do so, the easy one with Visual Studio pregenerating all of the exciting code – and the cool way to write it by hand. You can choose any one of them, the result will be the same.
Unfortunately a service cannot be run by itself (as long as it isn’t a WCF service, but for this objective, it isn’t), so you cannot debug your services and test them with Visual Studio, which is definitely a bad thing.