Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Remoting / September 2004

Tip: Looking for answers? Try searching our database.

Assembly loaded twice when Assembly.LoadFrom() is used

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fermo111 - 25 Sep 2004 00:39 GMT
The following code results in a strange behavior.

Assembly formAsm = Assembly.LoadFrom ("http://localhost/net/MyAssembly.dll");
Type formType = formAsm.GetType ("MySpace.MyForm");
object formObj = Activator.CreateInstance (formType);

Looking at the HTTP requests that are made, I noticed
that the assembly is requested twice from the server.
The first time the HTTP message is

GET /net/MyAssembly.dll

and the second time is

GET /net/MyAssembly.DLL    (DLL is uppercase this time)

The result is that the DLL takes twice the time to download.

Any help on this?

Luca
Ken Kolda - 25 Sep 2004 01:11 GMT
Although I can't explain that behavior, have you tried using

object frmObj = formAsm.CreateInstance("MySpace.MyForm")

instead?

Ken

> The following code results in a strange behavior.
>
[quoted text clipped - 17 lines]
>
> Luca
fermo111 - 25 Sep 2004 22:02 GMT
I used a packet analyzer to monitor the communications.
The behavior that I described happens on the call  to

Assembly.LoadFrom ("http://localhost/net/MyAssembly.dll")

and before the execution of the following lines.
Hope this may help to delimitate the problem.

Thank you

> Although I can't explain that behavior, have you tried using
>
[quoted text clipped - 26 lines]
> >
> > Luca
Girish Bharadwaj - 27 Sep 2004 19:18 GMT
What is the HTTP response for the first request. The server might be
responding with a "file not found"?

Signature

Girish Bharadwaj
http://msmvps.com/gbvb

> I used a packet analyzer to monitor the communications.
> The behavior that I described happens on the call  to
[quoted text clipped - 36 lines]
> > >
> > > Luca
fermo111 - 29 Sep 2004 14:03 GMT
Here is the output from the packet analyzer (semplified).
Note that the only difference between the 2 requests is the
capitalization of the extention (dll the first time, DLL the second
time).
Moreover the second request ignores the fact that the DLL has already
been transferred and doesn't send a
    If-Modified-Since: Fri, 24 Sep 2004 11:11:25 GMT
header on the HTTP request as one might have expected

Luca

Trace follows...

First Request
    Version: HTTP/1.1
    Method: GET
    URI: /siarm/dll/RichiesteAttivazione.dll
    Accept: */*
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET
CLR 1.1.4322; .NET CLR 1
    Host: agrisrv
    Connection: Keep-Alive

First Response
    Version: HTTP/1.1
    Result code: 200
    Result string: OK
    Server: Microsoft-IIS/5.0
    MS-Author-Via: MS-FP/4.0,DAV
    MicrosoftOfficeWebServer: 5.0_Collab
    X-Powered-By: ASP.NET
    Date: Wed, 29 Sep 2004 12:39:59 GMT
    Content-Type: application/x-msdownload
    Accept-Ranges: bytes
    Last-Modified: Fri, 24 Sep 2004 11:11:25 GMT
    ETag: "c5aa883b27a2c41:a69"
    Content-Length: 36864
   
Second Request
    Version: HTTP/1.1
    Method: GET
    URI: /siarm/dll/RichiesteAttivazione.DLL
    Accept: */*
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET
CLR 1.1.4322; .NET CLR 1
    Host: agrisrv
    Connection: Keep-Alive
   
Second response
    Version: HTTP/1.1
    Result code: 200
    Result string: OK
    Server: Microsoft-IIS/5.0
    MS-Author-Via: MS-FP/4.0,DAV
    MicrosoftOfficeWebServer: 5.0_Collab
    X-Powered-By: ASP.NET
    Date: Wed, 29 Sep 2004 12:39:59 GMT
    Content-Type: application/x-msdownload
    Accept-Ranges: bytes
    Last-Modified: Fri, 24 Sep 2004 11:11:25 GMT
    ETag: "c5aa883b27a2c41:a69"
    Content-Length: 36864   

> What is the HTTP response for the first request. The server might be
> responding with a "file not found"?
[quoted text clipped - 41 lines]
> > > >
> > > > Luca
Phil Wilson - 25 Sep 2004 18:22 GMT
I've seen this in similar circumstances, and it's my guess that when .NET
needs the assembly for reflection/metadata purposes it loads it as a
resource, and when it's needed for calling entrypoints, it loads it as an
executable DLL.  The result is that the DLL has two occurrences in the
hosting process.
Signature

Phil Wilson
[MVP Windows Installer]
Definitive Guide to Windows Installer
http://www.amazon.com/exec/obidos/tg/detail/-/1590592972/104-7044380-4696760

> The following code results in a strange behavior.
>
[quoted text clipped - 18 lines]
>
> Luca

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.