Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Problem using Assembly.LoadFrom within a web service

Reply
Thread Tools

Problem using Assembly.LoadFrom within a web service

 
 
surya
Guest
Posts: n/a
 
      01-19-2004
Hi,


I am using Assembly.LoadFrom within a web service to load assemblies from a

web site. This web site is in the same machine where I am running the web

service.

The Assembly.LoadFrom(httpsite) method throws a file not found exception.

I used the same code within a windows based application on the same machine

and it worked, so if the windows based application can load the assembly why

can't the web service find the same? I have been working on this problem

for a couple of days and can't figure out why it throws this exception. Is

this a security issue and if so why does it throw a file not found

exception?


Help is greatly appreciated.


Thanks in advance

Surya





 
Reply With Quote
 
 
 
 
Jan Tielens
Guest
Posts: n/a
 
      01-19-2004
Can you post some code how you load the dll? How does the httpsite string
looks like? (\\share\mydll.dll, http://web/mydll.dll, ...)

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


"surya" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi,
>
>
> I am using Assembly.LoadFrom within a web service to load assemblies from

a
>
> web site. This web site is in the same machine where I am running the web
>
> service.
>
> The Assembly.LoadFrom(httpsite) method throws a file not found exception.
>
> I used the same code within a windows based application on the same

machine
>
> and it worked, so if the windows based application can load the assembly

why
>
> can't the web service find the same? I have been working on this problem
>
> for a couple of days and can't figure out why it throws this exception. Is
>
> this a security issue and if so why does it throw a file not found
>
> exception?
>
>
> Help is greatly appreciated.
>
>
> Thanks in advance
>
> Surya
>
>
>
>
>



 
Reply With Quote
 
 
 
 
Jan Tielens
Guest
Posts: n/a
 
      01-19-2004
From the documentation:
http://tinyurl.com/2r7g4
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows
2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003
family, .NET Compact Framework

..NET Framework Security:

a.. ReflectionPermission when invoked late-bound through mechanisms such
as Type.InvokeMember. Associated enumeration:
ReflectionPermissionFlag.MemberAccess.
b.. FileIOPermission for reading a URI that begins with "file://".
Associated enumeration: FileIOPermissionAccess.Read
c.. WebPermission for reading a URI that does not begin with "file://".
So it could be a security issue. Which OS are you using? xp, 2000
server/pro, 2003?

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


"surya" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> Below is the code i am using in both the web service as well as the
> windows based application:
>
> Assembly ass =
> Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");
>
> Type cls1 = Type.GetType("ShareAssembly.Class1");
>
> object obj1 = ass.CreateInstance("ShareAssembly.Class1");
>
> System.Reflection.MethodInfo meth = cls1.GetMethod("Delete");
>
> meth.Invoke(obj1,null);
>
> This code works within a windows based/ console based application but
> throws a File not found exception within a web service.
>
> Within a web service, the code works if the assembly is loaded from a
> local directory but fails if it is loaded from a url site or from a

network
> share.
>
>
>
> Regards
>
> Surya
>
>
>
>
>
> "Jan Tielens" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Can you post some code how you load the dll? How does the httpsite

> string
> > looks like? (\\share\mydll.dll, http://web/mydll.dll, ...)
> >
> > --
> > Greetz
> >
> > Jan Tielens
> > ________________________________
> > Read my weblog: http://weblogs.asp.net/jan
> >
> >
> > "surya" <(E-Mail Removed)> wrote in message
> > news:#(E-Mail Removed)...
> > > Hi,
> > >
> > >
> > > I am using Assembly.LoadFrom within a web service to load assemblies

> from
> > a
> > >
> > > web site. This web site is in the same machine where I am running

the
> web
> > >
> > > service.
> > >
> > > The Assembly.LoadFrom(httpsite) method throws a file not found

> exception.
> > >
> > > I used the same code within a windows based application on the same

> > machine
> > >
> > > and it worked, so if the windows based application can load the

> assembly
> > why
> > >
> > > can't the web service find the same? I have been working on this

> problem
> > >
> > > for a couple of days and can't figure out why it throws this

> exception. Is
> > >
> > > this a security issue and if so why does it throw a file not found
> > >
> > > exception?
> > >
> > >
> > > Help is greatly appreciated.
> > >
> > >
> > > Thanks in advance
> > >
> > > Surya
> > >
> > >
> > >
> > >
> > >

> >
> >

>
>
>



 
Reply With Quote
 
surya
Guest
Posts: n/a
 
      01-19-2004
Hi,

Below is the code i am using in both the web service as well as the
windows based application:

Assembly ass =
Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");

Type cls1 = Type.GetType("ShareAssembly.Class1");

object obj1 = ass.CreateInstance("ShareAssembly.Class1");

System.Reflection.MethodInfo meth = cls1.GetMethod("Delete");

meth.Invoke(obj1,null);

This code works within a windows based/ console based application but
throws a File not found exception within a web service.

Within a web service, the code works if the assembly is loaded from a
local directory but fails if it is loaded from a url site or from a network
share.



Regards

Surya





"Jan Tielens" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Can you post some code how you load the dll? How does the httpsite

string
> looks like? (\\share\mydll.dll, http://web/mydll.dll, ...)
>
> --
> Greetz
>
> Jan Tielens
> ________________________________
> Read my weblog: http://weblogs.asp.net/jan
>
>
> "surya" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > Hi,
> >
> >
> > I am using Assembly.LoadFrom within a web service to load assemblies

from
> a
> >
> > web site. This web site is in the same machine where I am running the

web
> >
> > service.
> >
> > The Assembly.LoadFrom(httpsite) method throws a file not found

exception.
> >
> > I used the same code within a windows based application on the same

> machine
> >
> > and it worked, so if the windows based application can load the

assembly
> why
> >
> > can't the web service find the same? I have been working on this

problem
> >
> > for a couple of days and can't figure out why it throws this

exception. Is
> >
> > this a security issue and if so why does it throw a file not found
> >
> > exception?
> >
> >
> > Help is greatly appreciated.
> >
> >
> > Thanks in advance
> >
> > Surya
> >
> >
> >
> >
> >

>
>




 
Reply With Quote
 
surya
Guest
Posts: n/a
 
      01-19-2004
I am using a Windows 2000 server with IIS5.0.
I use the following code to load the assembly and then use it to create an
instance of a particular type.
Assembly ass =
Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");
This line goes through if it is called within a windows/console based app
but fails only within a web service.



Regards
Surya


"Jan Tielens" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> From the documentation:
> http://tinyurl.com/2r7g4
> Requirements
> Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition,

Windows
> 2000, Windows XP Home Edition, Windows XP Professional, Windows Server

2003
> family, .NET Compact Framework
>
> .NET Framework Security:
>
> a.. ReflectionPermission when invoked late-bound through mechanisms

such
> as Type.InvokeMember. Associated enumeration:
> ReflectionPermissionFlag.MemberAccess.
> b.. FileIOPermission for reading a URI that begins with "file://".
> Associated enumeration: FileIOPermissionAccess.Read
> c.. WebPermission for reading a URI that does not begin with

"file://".
> So it could be a security issue. Which OS are you using? xp, 2000
> server/pro, 2003?
>
> --
> Greetz
>
> Jan Tielens
> ________________________________
> Read my weblog: http://weblogs.asp.net/jan
>
>
> "surya" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > Below is the code i am using in both the web service as well as the
> > windows based application:
> >
> > Assembly ass =
> > Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");
> >
> > Type cls1 = Type.GetType("ShareAssembly.Class1");
> >
> > object obj1 = ass.CreateInstance("ShareAssembly.Class1");
> >
> > System.Reflection.MethodInfo meth = cls1.GetMethod("Delete");
> >
> > meth.Invoke(obj1,null);
> >
> > This code works within a windows based/ console based application

but
> > throws a File not found exception within a web service.
> >
> > Within a web service, the code works if the assembly is loaded from

a
> > local directory but fails if it is loaded from a url site or from a

> network
> > share.
> >
> >
> >
> > Regards
> >
> > Surya
> >
> >
> >
> >
> >
> > "Jan Tielens" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Can you post some code how you load the dll? How does the httpsite

> > string
> > > looks like? (\\share\mydll.dll, http://web/mydll.dll, ...)
> > >
> > > --
> > > Greetz
> > >
> > > Jan Tielens
> > > ________________________________
> > > Read my weblog: http://weblogs.asp.net/jan
> > >
> > >
> > > "surya" <(E-Mail Removed)> wrote in

message
> > > news:#(E-Mail Removed)...
> > > > Hi,
> > > >
> > > >
> > > > I am using Assembly.LoadFrom within a web service to load

assemblies
> > from
> > > a
> > > >
> > > > web site. This web site is in the same machine where I am

running
> the
> > web
> > > >
> > > > service.
> > > >
> > > > The Assembly.LoadFrom(httpsite) method throws a file not found

> > exception.
> > > >
> > > > I used the same code within a windows based application on the

same
> > > machine
> > > >
> > > > and it worked, so if the windows based application can load the

> > assembly
> > > why
> > > >
> > > > can't the web service find the same? I have been working on this

> > problem
> > > >
> > > > for a couple of days and can't figure out why it throws this

> > exception. Is
> > > >
> > > > this a security issue and if so why does it throw a file not

found
> > > >
> > > > exception?
> > > >
> > > >
> > > > Help is greatly appreciated.
> > > >
> > > >
> > > > Thanks in advance
> > > >
> > > > Surya
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >

> >
> >
> >

>
>




 
Reply With Quote
 
Jan Tielens
Guest
Posts: n/a
 
      01-19-2004
Ok, I've been able to reproduce this exception. It's a security issue, by
default the webservice can't download dll's (System.IO.FileLoadException:
HTTP download of assemblies has been disabled for this appdomain.).

Info I've found:
"HTTP download of assemblies has been disabled for this appdomain."

This error indicates that AppDomainSetup.DisallowCodeDownload has been set
on the domain. Setting his flag prevents any http:// download of assemblies
(or configuration files). ASP.NET sets this flag by default because the
internal usage of wininet/urlmon to download bits over http:// is not
supported under service processes.

So I don't know a solution for your problem... Is it possible to place this
dll in a file share instead of a website?
--
Greetz


Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


"surya" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I am using a Windows 2000 server with IIS5.0.
> I use the following code to load the assembly and then use it to create

an
> instance of a particular type.
> Assembly ass =
> Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");
> This line goes through if it is called within a windows/console based

app
> but fails only within a web service.
>
>
>
> Regards
> Surya
>
>
> "Jan Tielens" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > From the documentation:
> > http://tinyurl.com/2r7g4
> > Requirements
> > Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition,

> Windows
> > 2000, Windows XP Home Edition, Windows XP Professional, Windows Server

> 2003
> > family, .NET Compact Framework
> >
> > .NET Framework Security:
> >
> > a.. ReflectionPermission when invoked late-bound through mechanisms

> such
> > as Type.InvokeMember. Associated enumeration:
> > ReflectionPermissionFlag.MemberAccess.
> > b.. FileIOPermission for reading a URI that begins with "file://".
> > Associated enumeration: FileIOPermissionAccess.Read
> > c.. WebPermission for reading a URI that does not begin with

> "file://".
> > So it could be a security issue. Which OS are you using? xp, 2000
> > server/pro, 2003?
> >
> > --
> > Greetz
> >
> > Jan Tielens
> > ________________________________
> > Read my weblog: http://weblogs.asp.net/jan
> >
> >
> > "surya" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi,
> > >
> > > Below is the code i am using in both the web service as well as

the
> > > windows based application:
> > >
> > > Assembly ass =
> > > Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");
> > >
> > > Type cls1 = Type.GetType("ShareAssembly.Class1");
> > >
> > > object obj1 = ass.CreateInstance("ShareAssembly.Class1");
> > >
> > > System.Reflection.MethodInfo meth = cls1.GetMethod("Delete");
> > >
> > > meth.Invoke(obj1,null);
> > >
> > > This code works within a windows based/ console based application

> but
> > > throws a File not found exception within a web service.
> > >
> > > Within a web service, the code works if the assembly is loaded

from
> a
> > > local directory but fails if it is loaded from a url site or from a

> > network
> > > share.
> > >
> > >
> > >
> > > Regards
> > >
> > > Surya
> > >
> > >
> > >
> > >
> > >
> > > "Jan Tielens" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Can you post some code how you load the dll? How does the

httpsite
> > > string
> > > > looks like? (\\share\mydll.dll, http://web/mydll.dll, ...)
> > > >
> > > > --
> > > > Greetz
> > > >
> > > > Jan Tielens
> > > > ________________________________
> > > > Read my weblog: http://weblogs.asp.net/jan
> > > >
> > > >
> > > > "surya" <(E-Mail Removed)> wrote in

> message
> > > > news:#(E-Mail Removed)...
> > > > > Hi,
> > > > >
> > > > >
> > > > > I am using Assembly.LoadFrom within a web service to load

> assemblies
> > > from
> > > > a
> > > > >
> > > > > web site. This web site is in the same machine where I am

> running
> > the
> > > web
> > > > >
> > > > > service.
> > > > >
> > > > > The Assembly.LoadFrom(httpsite) method throws a file not found
> > > exception.
> > > > >
> > > > > I used the same code within a windows based application on the

> same
> > > > machine
> > > > >
> > > > > and it worked, so if the windows based application can load

the
> > > assembly
> > > > why
> > > > >
> > > > > can't the web service find the same? I have been working on

this
> > > problem
> > > > >
> > > > > for a couple of days and can't figure out why it throws this
> > > exception. Is
> > > > >
> > > > > this a security issue and if so why does it throw a file not

> found
> > > > >
> > > > > exception?
> > > > >
> > > > >
> > > > > Help is greatly appreciated.
> > > > >
> > > > >
> > > > > Thanks in advance
> > > > >
> > > > > Surya
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >

> >
> >

>
>
>



 
Reply With Quote
 
Jan Tielens
Guest
Posts: n/a
 
      01-19-2004
I was using the 1.1 version of the framework.

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


"surya" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks very much for the information.
> I get a FileNotFoundException but you get a FileloadException. I am

using
> .Net framework 1.0. R u using 1.1?
>
> I need to download it from a http site as this would allow to overwrite
> assemblies when they are in use by other applications. If I use a file
> share, the loadfrom locks the assembly that is loaded and so does not

allow
> the assembly to be overwritten.
>
> To get around the problem, I planned to load the files from a virtual
> directory in the same machine. I also planned to write a listener on the
> virtual directory folder (since the assemblies are on the same machine) to
> check whether the assembly is overwritten and raise an event when the
> assembly is overwritten. The applications that are using this assembly

could
> then decide to unload the appdomains that have loaded this assembly.
>
>
> Thanks very much for helping me out on this issue.
>
> Surya
>
>
> "Jan Tielens" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Ok, I've been able to reproduce this exception. It's a security issue,

> by
> > default the webservice can't download dll's

> (System.IO.FileLoadException:
> > HTTP download of assemblies has been disabled for this appdomain.).
> >
> > Info I've found:
> > "HTTP download of assemblies has been disabled for this appdomain."
> >
> > This error indicates that AppDomainSetup.DisallowCodeDownload has been

> set
> > on the domain. Setting his flag prevents any http:// download of

> assemblies
> > (or configuration files). ASP.NET sets this flag by default because

the
> > internal usage of wininet/urlmon to download bits over http:// is not
> > supported under service processes.
> >
> > So I don't know a solution for your problem... Is it possible to place

> this
> > dll in a file share instead of a website?
> > --
> > Greetz
> >
> >
> > Jan Tielens
> > ________________________________
> > Read my weblog: http://weblogs.asp.net/jan
> >
> >
> > "surya" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I am using a Windows 2000 server with IIS5.0.
> > > I use the following code to load the assembly and then use it to

> create
> > an
> > > instance of a particular type.
> > > Assembly ass =
> > > Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");
> > > This line goes through if it is called within a windows/console

> based
> > app
> > > but fails only within a web service.
> > >
> > >
> > >
> > > Regards
> > > Surya
> > >
> > >
> > > "Jan Tielens" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > From the documentation:
> > > > http://tinyurl.com/2r7g4
> > > > Requirements
> > > > Platforms: Windows 98, Windows NT 4.0, Windows Millennium

Edition,
> > > Windows
> > > > 2000, Windows XP Home Edition, Windows XP Professional, Windows

> Server
> > > 2003
> > > > family, .NET Compact Framework
> > > >
> > > > .NET Framework Security:
> > > >
> > > > a.. ReflectionPermission when invoked late-bound through

> mechanisms
> > > such
> > > > as Type.InvokeMember. Associated enumeration:
> > > > ReflectionPermissionFlag.MemberAccess.
> > > > b.. FileIOPermission for reading a URI that begins with

> "file://".
> > > > Associated enumeration: FileIOPermissionAccess.Read
> > > > c.. WebPermission for reading a URI that does not begin with
> > > "file://".
> > > > So it could be a security issue. Which OS are you using? xp,

2000
> > > > server/pro, 2003?
> > > >
> > > > --
> > > > Greetz
> > > >
> > > > Jan Tielens
> > > > ________________________________
> > > > Read my weblog: http://weblogs.asp.net/jan
> > > >
> > > >
> > > > "surya" <(E-Mail Removed)> wrote in

> message
> > > > news:(E-Mail Removed)...
> > > > > Hi,
> > > > >
> > > > > Below is the code i am using in both the web service as well

a
> s
> > the
> > > > > windows based application:
> > > > >
> > > > > Assembly ass =
> > > > >

Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");
> > > > >
> > > > > Type cls1 = Type.GetType("ShareAssembly.Class1");
> > > > >
> > > > > object obj1 = ass.CreateInstance("ShareAssembly.Class1");
> > > > >
> > > > > System.Reflection.MethodInfo meth =

cls1.GetMethod("Delete");
> > > > >
> > > > > meth.Invoke(obj1,null);
> > > > >
> > > > > This code works within a windows based/ console based

> application
> > > but
> > > > > throws a File not found exception within a web service.
> > > > >
> > > > > Within a web service, the code works if the assembly is

loaded
> > from
> > > a
> > > > > local directory but fails if it is loaded from a url site or

> from a
> > > > network
> > > > > share.
> > > > >
> > > > >
> > > > >
> > > > > Regards
> > > > >
> > > > > Surya
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "Jan Tielens" <(E-Mail Removed)> wrote in

message
> > > > > news:(E-Mail Removed)...
> > > > > > Can you post some code how you load the dll? How does the

> > httpsite
> > > > > string
> > > > > > looks like? (\\share\mydll.dll, http://web/mydll.dll, ...)
> > > > > >
> > > > > > --
> > > > > > Greetz
> > > > > >
> > > > > > Jan Tielens
> > > > > > ________________________________
> > > > > > Read my weblog: http://weblogs.asp.net/jan
> > > > > >
> > > > > >
> > > > > > "surya" <(E-Mail Removed)> wrote

in
> > > message
> > > > > > news:#(E-Mail Removed)...
> > > > > > > Hi,
> > > > > > >
> > > > > > >
> > > > > > > I am using Assembly.LoadFrom within a web service to

load
> > > assemblies
> > > > > from
> > > > > > a
> > > > > > >
> > > > > > > web site. This web site is in the same machine where I

am
> > > running
> > > > the
> > > > > web
> > > > > > >
> > > > > > > service.
> > > > > > >
> > > > > > > The Assembly.LoadFrom(httpsite) method throws a file not

> found
> > > > > exception.
> > > > > > >
> > > > > > > I used the same code within a windows based application

on
> the
> > > same
> > > > > > machine
> > > > > > >
> > > > > > > and it worked, so if the windows based application can

> load
> > the
> > > > > assembly
> > > > > > why
> > > > > > >
> > > > > > > can't the web service find the same? I have been working

> on
> > this
> > > > > problem
> > > > > > >
> > > > > > > for a couple of days and can't figure out why it throws

> this
> > > > > exception. Is
> > > > > > >
> > > > > > > this a security issue and if so why does it throw a file

> not
> > > found
> > > > > > >
> > > > > > > exception?
> > > > > > >
> > > > > > >
> > > > > > > Help is greatly appreciated.
> > > > > > >
> > > > > > >
> > > > > > > Thanks in advance
> > > > > > >
> > > > > > > Surya
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >

> >
> >

>
>
>



 
Reply With Quote
 
surya
Guest
Posts: n/a
 
      01-19-2004
Thanks very much for the information.
I get a FileNotFoundException but you get a FileloadException. I am using
..Net framework 1.0. R u using 1.1?

I need to download it from a http site as this would allow to overwrite
assemblies when they are in use by other applications. If I use a file
share, the loadfrom locks the assembly that is loaded and so does not allow
the assembly to be overwritten.

To get around the problem, I planned to load the files from a virtual
directory in the same machine. I also planned to write a listener on the
virtual directory folder (since the assemblies are on the same machine) to
check whether the assembly is overwritten and raise an event when the
assembly is overwritten. The applications that are using this assembly could
then decide to unload the appdomains that have loaded this assembly.


Thanks very much for helping me out on this issue.

Surya


"Jan Tielens" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Ok, I've been able to reproduce this exception. It's a security issue,

by
> default the webservice can't download dll's

(System.IO.FileLoadException:
> HTTP download of assemblies has been disabled for this appdomain.).
>
> Info I've found:
> "HTTP download of assemblies has been disabled for this appdomain."
>
> This error indicates that AppDomainSetup.DisallowCodeDownload has been

set
> on the domain. Setting his flag prevents any http:// download of

assemblies
> (or configuration files). ASP.NET sets this flag by default because the
> internal usage of wininet/urlmon to download bits over http:// is not
> supported under service processes.
>
> So I don't know a solution for your problem... Is it possible to place

this
> dll in a file share instead of a website?
> --
> Greetz
>
>
> Jan Tielens
> ________________________________
> Read my weblog: http://weblogs.asp.net/jan
>
>
> "surya" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I am using a Windows 2000 server with IIS5.0.
> > I use the following code to load the assembly and then use it to

create
> an
> > instance of a particular type.
> > Assembly ass =
> > Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");
> > This line goes through if it is called within a windows/console

based
> app
> > but fails only within a web service.
> >
> >
> >
> > Regards
> > Surya
> >
> >
> > "Jan Tielens" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > From the documentation:
> > > http://tinyurl.com/2r7g4
> > > Requirements
> > > Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition,

> > Windows
> > > 2000, Windows XP Home Edition, Windows XP Professional, Windows

Server
> > 2003
> > > family, .NET Compact Framework
> > >
> > > .NET Framework Security:
> > >
> > > a.. ReflectionPermission when invoked late-bound through

mechanisms
> > such
> > > as Type.InvokeMember. Associated enumeration:
> > > ReflectionPermissionFlag.MemberAccess.
> > > b.. FileIOPermission for reading a URI that begins with

"file://".
> > > Associated enumeration: FileIOPermissionAccess.Read
> > > c.. WebPermission for reading a URI that does not begin with

> > "file://".
> > > So it could be a security issue. Which OS are you using? xp, 2000
> > > server/pro, 2003?
> > >
> > > --
> > > Greetz
> > >
> > > Jan Tielens
> > > ________________________________
> > > Read my weblog: http://weblogs.asp.net/jan
> > >
> > >
> > > "surya" <(E-Mail Removed)> wrote in

message
> > > news:(E-Mail Removed)...
> > > > Hi,
> > > >
> > > > Below is the code i am using in both the web service as well a

s
> the
> > > > windows based application:
> > > >
> > > > Assembly ass =
> > > > Assembly.LoadFrom("http://localhost/storage/shareassembly.dll");
> > > >
> > > > Type cls1 = Type.GetType("ShareAssembly.Class1");
> > > >
> > > > object obj1 = ass.CreateInstance("ShareAssembly.Class1");
> > > >
> > > > System.Reflection.MethodInfo meth = cls1.GetMethod("Delete");
> > > >
> > > > meth.Invoke(obj1,null);
> > > >
> > > > This code works within a windows based/ console based

application
> > but
> > > > throws a File not found exception within a web service.
> > > >
> > > > Within a web service, the code works if the assembly is loaded

> from
> > a
> > > > local directory but fails if it is loaded from a url site or

from a
> > > network
> > > > share.
> > > >
> > > >
> > > >
> > > > Regards
> > > >
> > > > Surya
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > "Jan Tielens" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > Can you post some code how you load the dll? How does the

> httpsite
> > > > string
> > > > > looks like? (\\share\mydll.dll, http://web/mydll.dll, ...)
> > > > >
> > > > > --
> > > > > Greetz
> > > > >
> > > > > Jan Tielens
> > > > > ________________________________
> > > > > Read my weblog: http://weblogs.asp.net/jan
> > > > >
> > > > >
> > > > > "surya" <(E-Mail Removed)> wrote in

> > message
> > > > > news:#(E-Mail Removed)...
> > > > > > Hi,
> > > > > >
> > > > > >
> > > > > > I am using Assembly.LoadFrom within a web service to load

> > assemblies
> > > > from
> > > > > a
> > > > > >
> > > > > > web site. This web site is in the same machine where I am

> > running
> > > the
> > > > web
> > > > > >
> > > > > > service.
> > > > > >
> > > > > > The Assembly.LoadFrom(httpsite) method throws a file not

found
> > > > exception.
> > > > > >
> > > > > > I used the same code within a windows based application on

the
> > same
> > > > > machine
> > > > > >
> > > > > > and it worked, so if the windows based application can

load
> the
> > > > assembly
> > > > > why
> > > > > >
> > > > > > can't the web service find the same? I have been working

on
> this
> > > > problem
> > > > > >
> > > > > > for a couple of days and can't figure out why it throws

this
> > > > exception. Is
> > > > > >
> > > > > > this a security issue and if so why does it throw a file

not
> > found
> > > > > >
> > > > > > exception?
> > > > > >
> > > > > >
> > > > > > Help is greatly appreciated.
> > > > > >
> > > > > >
> > > > > > Thanks in advance
> > > > > >
> > > > > > Surya
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >

> >
> >
> >

>
>




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does timer in Web Service Global.asax block my Web Service from processing web-site requests? Leo Violette ASP .Net Web Services 0 04-17-2009 12:39 AM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
Calling a Web Service using Axis, from within an Axis Web Service running under Tomcat hocho888 Java 1 04-29-2005 08:26 PM
Referencing web service complex data type within a second web service (like a delegate) Mike Dearman ASP .Net Web Services 1 06-23-2004 03:11 PM
Calling an Asynch web service within a web service. Tony T. ASP .Net Web Services 0 04-25-2004 11:46 PM



Advertisments