Groups | Blog | Home
all groups > dotnet remoting > september 2004 >

dotnet remoting : Assembly loaded twice when Assembly.LoadFrom() is used


fermo111 NO[at]SPAM yahoo.it
9/24/2004 4:39:54 PM
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?

Ken Kolda
9/24/2004 5:11:30 PM
Although I can't explain that behavior, have you tried using

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

instead?

Ken


[quoted text, click to view]

Phil Wilson
9/25/2004 10:22:12 AM
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.
--
Phil Wilson
[MVP Windows Installer]
Definitive Guide to Windows Installer
http://www.amazon.com/exec/obidos/tg/detail/-/1590592972/104-7044380-4696760

[quoted text, click to view]

fermo111 NO[at]SPAM yahoo.it
9/25/2004 2:02:19 PM
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

[quoted text, click to view]
Girish Bharadwaj
9/27/2004 2:18:21 PM
What is the HTTP response for the first request. The server might be
responding with a "file not found"?

--
Girish Bharadwaj
http://msmvps.com/gbvb
[quoted text, click to view]

fermo111 NO[at]SPAM yahoo.it
9/29/2004 6:03:21 AM
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

[quoted text, click to view]
AddThis Social Bookmark Button