Problem using Assembly.LoadFrom within a web service

Discussion in 'ASP .Net Web Services' started by surya, Jan 19, 2004.

  1. surya

    surya Guest

    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
     
    surya, Jan 19, 2004
    #1
    1. Advertising

  2. surya

    Jan Tielens Guest

    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" <> wrote in message
    news:#...
    > 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
    >
    >
    >
    >
    >
     
    Jan Tielens, Jan 19, 2004
    #2
    1. Advertising

  3. surya

    Jan Tielens Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    > > 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" <> wrote in message
    > > news:#...
    > > > 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
    > > >
    > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    >
     
    Jan Tielens, Jan 19, 2004
    #3
  4. surya

    surya Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:#...
    > > 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
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    surya, Jan 19, 2004
    #4
  5. surya

    surya Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    > > 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" <> wrote in message
    > > news:...
    > > > 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" <> wrote in

    message
    > > > news:#...
    > > > > 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
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >
    > >

    >
    >
     
    surya, Jan 19, 2004
    #5
  6. surya

    Jan Tielens Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    > > 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" <> wrote in message
    > > news:...
    > > > 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" <> wrote in message
    > > > news:...
    > > > > 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" <> wrote in

    > message
    > > > > news:#...
    > > > > > 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
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    >
     
    Jan Tielens, Jan 19, 2004
    #6
  7. surya

    Jan Tielens Guest

    I was using the 1.1 version of the framework.

    --
    Greetz

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


    "surya" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    > > 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" <> wrote in message
    > > news:...
    > > > 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" <> wrote in message
    > > > news:...
    > > > > 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" <> wrote in

    > message
    > > > > news:...
    > > > > > 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" <> wrote in

    message
    > > > > > news:...
    > > > > > > 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" <> wrote

    in
    > > > message
    > > > > > > news:#...
    > > > > > > > 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
    > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    >
     
    Jan Tielens, Jan 19, 2004
    #7
  8. surya

    surya Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    > > 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" <> wrote in message
    > > news:...
    > > > 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" <> wrote in

    message
    > > > news:...
    > > > > 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" <> wrote in message
    > > > > news:...
    > > > > > 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" <> wrote in

    > > message
    > > > > > news:#...
    > > > > > > 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
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >
    > >

    >
    >
     
    surya, Jan 19, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wolf
    Replies:
    4
    Views:
    7,873
    dcushnie
    Sep 11, 2006
  2. Timothy Parez

    Assembly.LoadFrom() & GAC

    Timothy Parez, Feb 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,633
    Timothy Parez
    Feb 22, 2004
  3. posthumecaver
    Replies:
    0
    Views:
    335
    posthumecaver
    Aug 22, 2003
  4. Oenone
    Replies:
    0
    Views:
    532
    Oenone
    Jul 11, 2005
  5. pkellner
    Replies:
    0
    Views:
    503
    pkellner
    Apr 27, 2007
Loading...

Share This Page