Search code examples
c#asp.net.netdllclr

Will two identical dll's be both loaded (if located in different locations and referenced by two different applications)


Suppose I have two ASP.NET web sites hosted on IIS. Both have the same DLL assembly "1.dll" in the bin folder. Will both "1.dll" DLL's be loaded by CLR, or is it smart enough to load it once and afterwise check if assemly with the required version/name was already loaded elsewhere?

Will it make difference if "1.dll" is referenced without requiring specific version?

Will it make difference if both sites are using same or different application pools?


Solution

  • Assemblies are loaded into app domains which is a logical boundary within a process. So if your web application are running in different application pools (I mean different worker process) - Yes, it will load again.

    Will it make difference if "1.dll" is referenced without requiring specific version? No

    Will it make difference if both sites are using same or different application pools? If application pool is same, then it might use shared app domain(though am not very sure)

    Update : to answer your second question, i checked loaded assemblies in process explorer for two web sites running in a same pool, different app domains have there own instance of assemblies loaded.