DLL in ASP.NET

Hi

I am migrating web application from iis 6 \Windows 2003 R2 ( 32 Bit ) to iis8.5 / Windows 2012 r2 running on .NET Framework version 2.

After migration , I got error messages

Member name " System .globalization.compareinfo m_SortVersion' not found.

I think this message is related to the mscorlib.dll.

I need to compare this DLL on IIS 8.5 to the IIS6 in GAC.

when I search the file, I find it many locations with different version numbers.

Will you please tell me which folder should be checking on IIS 6 and IIS 8.5 against version number etc.

and If the version number is not the same with the IIS 6, then should I copy the dll from IIS 6 to IIS 8.

Thanks

F.
toronto2456Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:
Your information appears to be correct about the gacutil.

You can host multiple versions of the DLL in the gac (that's the whole point of it).  From there I would change the web.config using the exact version of the copied DLL.

Nothing to lose by trying it.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
If you have a bin folder underneath your application that would be the first place to look.

If not you need to  check the GAC (%windir%\assembly)

Note that the application pool should also be running underneath 2.0 to ensure you're loading the right DLLs.
0
 
toronto2456Author Commented:
Thanks Kyle,

It is not in local bin folder but I found it under several location on the server. But as you said, I also found it under  %windir%\assembly for the .NET version 2. When I compare the mscorblib.dll files from the same location from IIS 6 ( Windows 2003 ) and IIS 8.5(Windows 2012 R2 ), I see that they are are not the same version files. When I was moving the web site , I have just copied the content location abd build the site again.

Do you think I should also copy the mscorblib.dll from Windows 2003 to windows 2012 R2 to the same location (%windir%\assembly)

Thanks

note :application pools is running under V2. When I check the mscorlib.dll.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
Kyle AbrahamsSenior .Net DeveloperCommented:
You can put the other version of the MSCORLIB in the assmebly folder.  But also ensure you're referencing that version in your web.config.

Note to get the DLL out of the GAC:
browse to
%windir%\assembly\GAC_MSIL

Open in new window

0
 
toronto2456Author Commented:
Thanks,

I found the mscorlib in %windir%\assembly\GAC_32 folder in both Windows 2003 and windows 2012 R2. I am not sure if the version numbers are the same. I have added screen shots.

and the only line including mscorlib in web.config file is the following line

<add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">

I think everything seems okey.

F.
Windows-2003.PNG
Windows-2012_R2.PNG
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
The one on 2012 seems a bit more  recent (3662 on the old server vs 8009 on the new server).

If you copied the version up to the new server and are still having issues try putting in the full version that works (eg: the 3662) and still see if you have issues.
0
 
toronto2456Author Commented:
Thanks Kyle,  

I haven't copied anything yet. I just copied the site content folder after manually building the site on windows 2012 R2.

Since application works fine on IIS6, I think I need to copy the file with the version 3662 to the Windows 2012 R2 and I will keep the both version.  

to do that, I think I need to extract the dll from file system and registered it on the Windows 2012 r2 using gacutil.

From What I read on the net, simly drag and drop the .dll file doesn't work anymore.
0
 
toronto2456Author Commented:
You are right,

the thing I don't understand is that in the web.config file, version number appears as just Version=2.0.0.0,  

<add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">


When you mean updating the web.config file, do you mean entering the whole 2.0.50727.3662 so that it look like as follows

<add type="System.Exception, mscorlib, Version=2.0.50727.3662, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">

Sorry I am very unknowledgeable about .NET programming, jus trying to bring the site up and running
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Understood, and yes that second one looks correct (sorry for the late reply, been a very busy week over here).

<add type="System.Exception, mscorlib, Version=2.0.50727.3662, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">

Open in new window


Essentially saying 2.0.0.0 will look for any 2.0 DLL.  Specifying the specific version should help narrow down to the exact dll that's working for you.  

If that doesn't work we can try an assembly redirection, but don't see why it shouldn't.
0
 
toronto2456Author Commented:
Hi Kyle,

Thanks very much for the help

I will try this. But First I will have to extract dll from the source to deploy to target using gacutil. I have noticed that you can only see the DLL files if you put them as %windir%\assembly\GAC_MSIL in the RUN or search dialog box,then you can browse them to copy DLL file. have no idea why it is so. If you directly browse the location, you won't see the files and do nothing.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Leave it to microsoft to make the rules.  Not wanting to accidentally delete a DLL comes to mind but there are other ways of dealing with that.
0
 
toronto2456Author Commented:
Yes you are right. I foud an powershell script that deploy the dll as follows
----------------------------------------------------------------------------------------------------------------------------
#Note that you should be running PowerShell as an Administrator
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")            
$publish = New-Object System.EnterpriseServices.Internal.Publish            
$publish.GacInstall("C:\Path\To\DLL.dll")
 
#If installing into the GAC on a server hosting web applications in IIS, you need to restart IIS for the applications to pick up the change.
#Uncomment the next line if necessary...
#iisreset
------------------------------------------------------------------------------------------------------------------------------------

But my app is running under .NET version 2 not for Version 4. So if I used this script , do you think it will install the DLL( that I have extract from IIS 6 on Windows 2003 from c:\windows
\assembly ) to the right location or it will automatically install to the NET Version 4 location which is c:\windows\microsoft.net\assmebly  folder?

I think DLL for .Net version 2 needs to go c:\Windows\assembly

F.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
$publish.GacInstall("C:\Path\To\DLL.dll")

handles it.  It's just loading a 4.0 DLL to do the install.
0
 
toronto2456Author Commented:
Thanks Kyle,

Then I am just going to copy the mscorblib.DLL to the c:\Temp\ and I will modify as $publish.GacInstall("C:\TEMP\DLL.dll")
and hopefully it will appear in assembly for .NET version 2 folder which is c:\windows\assebly asmy site is under .NET version 2 app pool.
the only thing that There are other applications running on the system and I think I need a reserver level backup before playing DLL


Thanks

F.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
should be:

$publish.GacInstall("C:\TEMP\mscorblib.dll")

and you can have multiple versions of the file in there.  But never hurts to have a backup.
0
 
toronto2456Author Commented:
Definetely , I will take backup.

Kyle, What if If I needed to deploy an DLL for .NET version 4 to c:\windows\microsoft.NET\assembly location.

it will automatically install the DLL in that location or should I make some changes.

or the question is irrelevant. I am asking this question becasue , my app is undeer Version 2

I like to know what I would be doing if my app was working under .NET version 4

Thanks Kyle

F.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
That's the beauty of the GAC (c:\windows\Assembly) it's a one stop shop place to look for .net.    The GAC will store multiple versions of each file.  (EG: an mscorlib for 2.0.1, 2.0.3, 4.0, etc)


How DLLs are loaded can be found here:
https://msdn.microsoft.com/en-us/library/aa720133.aspx

if you're interested.
0
 
toronto2456Author Commented:
Hey Kyle,

Thanks for all them information you provide, much appriciated

I have closed the question but just last question  I might sound like an idiot but just want to clear.

I have read that

c:\windows\assembly                                is for .NET version 2  
c:\windows\microsoft.net \assembly      is for .NET version 4

in that PowerShell code, If I wanted to deploy DLL for .NET version 4 , then it needs to go  c:\windows\microsoft.net \assembly.
But in the code there is no variable to make that distinction ( seems to me of course ! ).

or is there ? how does it know if it is .NET 2 or .NET version 4. so that it put to right location.

note : i also read that using gacutil is not recommended. the only option left is to use powershell then.

Thanks

F.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
You are correct that they get deployed to different file paths.

see: http://www.devcurry.com/2010/06/net-40-has-2-global-assembly-cache-gac.html for the reasons why if you're interested.

I believe the gacutil can differentiate between 4.0 and 2.0 assemblies - but not entirely certain (can find any documentation that says one way or the other).  I'm glad this issue is resolved for now though.
0
 
toronto2456Author Commented:
Thanks Kyle,

F.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.