Solved

DLL in ASP.NET

Posted on 2016-11-02
20
41 Views
Last Modified: 2016-11-09
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.
0
Comment
Question by:toronto2456
  • 10
  • 10
20 Comments
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41871256
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
 

Author Comment

by:toronto2456
ID: 41872049
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
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41873176
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
 

Author Comment

by:toronto2456
ID: 41874111
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
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41874332
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
 

Author Comment

by:toronto2456
ID: 41874365
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
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 41874383
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
 

Author Comment

by:toronto2456
ID: 41874502
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
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41874913
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
 

Author Comment

by:toronto2456
ID: 41877080
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41877481
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
 

Author Comment

by:toronto2456
ID: 41877502
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
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41877657
$publish.GacInstall("C:\Path\To\DLL.dll")

handles it.  It's just loading a 4.0 DLL to do the install.
0
 

Author Comment

by:toronto2456
ID: 41877770
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
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41877869
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
 

Author Comment

by:toronto2456
ID: 41878747
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
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41879152
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
 

Author Comment

by:toronto2456
ID: 41879266
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
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41879538
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
 

Author Comment

by:toronto2456
ID: 41881125
Thanks Kyle,

F.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now