Hi friends,
As we know that if we want separate execution of different different application on .NET framework we use application domain but if we want same thing without application domain , is it possible or not ? if yes then plz. explain
Thanks
Loading

Sam HobbsPosted Nov 27, 2011, 9:00 AM
I am tempted to say it is Microsoft shenanigans but when I look up shenanigans it seems to harsh. I do think however that it is Microsoft using confusing terminology. I just don't know if it is marketing people or technical people in Microsoft that decided use the exe extension for executable code that is so different from any other type of executable code except for possibly Java executable files.
VulpesPosted Nov 27, 2011, 7:35 AM
Sam HobbsPosted Nov 26, 2011, 2:02 PM
Attached is a project with a modified version of what Vulpes posted. My directory structure is different from what Vulpes used so the path to the second application is different plus I used different names. This version shows a little more. First note that the process handle (Process.Handle) is different for the two applications. If however we use GetProcessId to get the process id for the handle then we get the same process id.
VulpesPosted Nov 26, 2011, 9:17 AM
Sam HobbsPosted Nov 26, 2011, 3:33 AM
Until Microsoft releases a new version of Windows that supports managed code as the native format, "normal" exe files are exe files that are either unmanaged entirely or that begin execution as an unmanaged exe.
Deepak DwijPosted Nov 24, 2011, 4:10 PM
VulpesPosted Nov 24, 2011, 9:18 AM
An application domain executes an assembly and it's possible for an assembly to have the .exe file extension. However, it's not a 'normal' .exe because it contains IL and metadata rather than native code.
Here's a quick example of two .NET exes running in different application domains within a single process:
// domaintester.cs
using System;
using System.Diagnostics;
class Program
{
static void Main()
{
AppDomain currentDomain = AppDomain.CurrentDomain;
string procName = Process.GetCurrentProcess().ProcessName;
if (currentDomain.IsDefaultAppDomain())
{
Console.WriteLine("Hello from the default domain in {0}", procName);
}
AppDomain testDomain = AppDomain.CreateDomain("TestDomain");
testDomain.ExecuteAssembly("testdomain.exe");
Console.ReadKey();
}
}
// testdomain.cs
using System;
using System.Diagnostics;
class Program
{
static void Main()
{
AppDomain currentDomain = AppDomain.CurrentDomain;
string procName = Process.GetCurrentProcess().ProcessName;
if (!currentDomain.IsDefaultAppDomain())
{
Console.WriteLine("Hello from {0} in {1}", currentDomain.FriendlyName, procName);
}
}
}
When you build these two files to domaintester.exe and testdomain.exe respectively and then run the former, you should see the following output:
Hello from the default domain in domaintester
Hello from TestDomain in domaintester
Although you can have two (or more) .NET .exes running in the same process, Sam's probably right that you can't have more than one 'normal' .exe running within a single process.
Sam HobbsPosted Nov 23, 2011, 7:39 PM
VulpesPosted Nov 23, 2011, 6:56 PM
Deepak DwijPosted Nov 23, 2011, 6:19 PM
Sam HobbsPosted Nov 23, 2011, 3:08 PM
VulpesPosted Nov 23, 2011, 12:25 PM