[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Assembly loaded twice when Assembly.LoadFrom() is used

fermo111

9/24/2004 11:40:00 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?

Luca
5 Answers

Ken Kolda

9/25/2004 12:12:00 AM

0

Although I can't explain that behavior, have you tried using

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

instead?

Ken


"fermo111" <fermo111@yahoo.it> wrote in message
news:649247dd.0409241539.7e1a1660@posting.google.com...
> 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


Phil Wilson

9/25/2004 5:22:00 PM

0

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-70443...

"fermo111" <fermo111@yahoo.it> wrote in message
news:649247dd.0409241539.7e1a1660@posting.google.com...
> 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


fermo111

9/25/2004 9:02:00 PM

0

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

"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message news:<OYmAKRpoEHA.1308@TK2MSFTNGP14.phx.gbl>...
> Although I can't explain that behavior, have you tried using
>
> object frmObj = formAsm.CreateInstance("MySpace.MyForm")
>
> instead?
>
> Ken
>
>
> "fermo111" <fermo111@yahoo.it> wrote in message
> news:649247dd.0409241539.7e1a1660@posting.google.com...
> > 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

Girish Bharadwaj

9/27/2004 6:18:00 PM

0

What is the HTTP response for the first request. The server might be
responding with a "file not found"?

--
Girish Bharadwaj
http://msmvp...
"fermo111" <fermo111@yahoo.it> wrote in message
news:649247dd.0409251302.6e288957@posting.google.com...
> 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
>
> "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
news:<OYmAKRpoEHA.1308@TK2MSFTNGP14.phx.gbl>...
> > Although I can't explain that behavior, have you tried using
> >
> > object frmObj = formAsm.CreateInstance("MySpace.MyForm")
> >
> > instead?
> >
> > Ken
> >
> >
> > "fermo111" <fermo111@yahoo.it> wrote in message
> > news:649247dd.0409241539.7e1a1660@posting.google.com...
> > > 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


fermo111

9/29/2004 1:03:00 PM

0

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

"Girish Bharadwaj" <girishb@mvps.org> wrote in message news:<elBkf5LpEHA.3488@TK2MSFTNGP12.phx.gbl>...
> What is the HTTP response for the first request. The server might be
> responding with a "file not found"?
>
> --
> Girish Bharadwaj
> http://msmvp...
> "fermo111" <fermo111@yahoo.it> wrote in message
> news:649247dd.0409251302.6e288957@posting.google.com...
> > 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
> >
> > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
> news:<OYmAKRpoEHA.1308@TK2MSFTNGP14.phx.gbl>...
> > > Although I can't explain that behavior, have you tried using
> > >
> > > object frmObj = formAsm.CreateInstance("MySpace.MyForm")
> > >
> > > instead?
> > >
> > > Ken
> > >
> > >
> > > "fermo111" <fermo111@yahoo.it> wrote in message
> > > news:649247dd.0409241539.7e1a1660@posting.google.com...
> > > > 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