C# - Loading DLL Into Separate AppDomain?

Dec 22, 2010

I am writing a plugin architecture. My plugin dlls are located in a sub directory from where the plugin manager is running. I am loading the plugins into a separate AppDomain as the following:

string subDir;//initialized to the path of the module's directory.
AppDomainSetup setup = new AppDomainSetup();
setup.PrivateBinPath = subDir;
setup.ApplicationBase = subDir;
AppDomain newDomain= AppDomain.CreateDomain(subDir, null, setup);
byte[] file = File.ReadAllBytes(dllPath);//dll path is a dll inside subDir
newDomain.Load(file);

However. newDomain.Load returns an assembly which the currently domain attempts to load. Because the plugin dlls are in a sub directory, the current domain cannot and should not see these dlls and the current domain throws a FileLoadException"ex = {"Could not load file or assembly ... or one of its dependencies."

The question is, can we load an assembly into a separate AppDomain without it returning the loaded assembly?

I know I can add a handler for the AssemblyResolve event in the current domain and return a null, but I would prefer to not to go this route.

View 1 Replies


Similar Messages:

C# - Loading Sandbox AppDomain Crashes Debugger?

Mar 2, 2011

I am creating a sandbox AppDomain so I can load up an assembly and release it.

var sandbox = AppDomain.CreateDomain("Sandbox", null,
AppDomain.CurrentDomain.SetupInformation);

However when I Load an assembly into to sandbox, the debugger crashes. I am in ASP.NET.

var assemblyName = AssemblyName.GetAssemblyName(assemblyPath);
var assembly = pluginDomain.Load(assemblyName); // crash here

View 1 Replies

DataSource Controls :: Display Results From Two Separate Tables In Two Separate Databases?

Jan 14, 2010

I have access to two seperate databases (mySQL) located on two servers. I need to get the data, link the tables on a key field and display the results in a datagrid. My challenge is that if the search criteria changes for the display it affects rows returned from on table and should thus automatically affect the linked table and resulting data returned.

what the best approach would be to achieving this? So far I have set up a dataset with a dataadapter and table for each connection and then linked the tables in the dataset. The problem that I'm having is getting the linked resultsets to work.

On my form I have the datagrid with two Objectdatasources one for each dataadapter and i believe that's where I'm going wrong...

View 1 Replies

Failed To Create AppDomain?

Sep 26, 2010

What is this Error For? I repaired my Vs but this did not solve it.

My OS : Windows 7 64 bit home edition. Visual studio 2010 Ultimate. Does My question need more information?

View 3 Replies

Using Ninject With WCF Services Within Web Applications Appdomain?

Feb 4, 2011

It's my understanding that if you want to use the WCF-Ninject extension, it assumes that you are hosting your WCF services in their own AppDomain.

I'm already using the Ninject.Web extension and asp.net compatibility mode to get at the Membership Provider and Session.

Is there a way utilize my Ninject with my WCF services that are hosted in the same AppDomain as my Web Application?

View 1 Replies

Appdomain - Add Directories To Shadow Copy?

Oct 30, 2010

In my ASP.NET app, I'm attempting to add another directory to be have the DLLs in it shadow copied.

The only method I found that will allow m to do this is AppDomain.CurrentDomain.SetShadowCopyPath.

However, this method is marked as Obsolete. MSDN has this to say about it

SetShadowCopyPath(String path) Message: AppDomain.SetShadowCopyPath has been deprecated. investigate the use of AppDomainSetup.ShadowCopyDirectories instead.

However, the AppDomainSetup.ShadowCopyDirectories property doesn't seem to change whenever I set a value to it.

AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories = "mydirectory;bin"; string test = AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories; // returns bin, which was the original directory

Is there a reason that it won't change and is there a work around?

View 1 Replies

MVC :: How To Separate Project Into Separate Layers

Feb 2, 2010

I am beginner to ASP.NET MVC.

We are doing project in Asp.Net MVC and Nhibernate.

How to seperate my project in to layers ? how to design classes ?

should i followany patterns ? repository patterns ?

View 3 Replies

Clear The Application Cache Without Resetting The AppDomain?

Feb 3, 2010

I would like to reset/clear an item in the Cache, but without resetting the application or writing a specialized page just for this. ie, a non-programmatic solution.

View 3 Replies

How To Prevent AppDomain Recycles In IIS 7.0 When Deleting A Sub Directory

Jan 20, 2010

I have an asp.net web application that allows users to upload files to an 'uploads' directory that is located in the same virtual directory as the web app. Each uploaded file goes into a temporary sub directory that is named after the user's session id. Once I'm finished with the files, I delete the temp sub directory. The only problem is that when a sub directory is deleted, the AppDomain gets recycled and kills all user sessions (using inproc session state). The culprit appears to be a FileChangesMonitor that watches for changes in all sub directories in the application.

The following code works great in IIS 6.0 running on Windows Server 2003 to disable the FileChangesMonitor for sub directories, but for some reason it's not working in IIS 7.0 on Windows Server 2008:

System.Reflection.PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
object o = p.GetValue(null, null);
System.Reflection.FieldInfo f = o.GetType().GetField("_dirMonSubdirs", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.IgnoreCase);
object monitor = f.GetValue(o);
System.Reflection.MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
m.Invoke(monitor, new object[] { });

I found another solution that disables the FileChangesMonitor altogether here. But this is not the ideal solution as I still want to monitor all other files except for the temp sub directories in the 'uploads' directory. Why does this work in IIS 6.0 and not in IIS 7.0? In IIS 7.0 can you specify sub directories in a virtual folder you want to disable recycling on? Is there another way to do this without using reflection?

View 2 Replies

C# - Forced To Use Process But Need AppDomain - Like Security Policies?

Jul 30, 2010

Maxima.exe is a Computer Algebra System built as a native code rather than a managed code. MyService works as a socket server, it will instantiate a new process of Maxima for each browser submitting mathematics expression to Web Server. I cannot use AppDomain here because Maxima is a native code. However I want security policies provided by AppDomain such as restriction to write data on file system.My question is, how can I get the AppDomain-like security policies when I instantiate Maxima in a process rather than in an AppDomain?

View 1 Replies

Appdomain Recycle Settings On Mod_mono & Apache?

Apr 30, 2010

How does one control the application recycle settings for an ASP.NET application runnin on mod_mono & Apache ?

On IIS6 & 7 there was an option to specify either a time period, a number of requests, etc. when the AppDomain would be recycled and the application would basically do an Application_End() / Application_Start().

I am seeing the same behaviour on mod_mono & Apache ,but I can't find where to change the settings.

View 2 Replies

ApplicationManager.CreateObject Fails To Load Assembly In New AppDomain?

Mar 4, 2010

I'm trying to develop a web application that dispatch (Dispatcher) to multiple versions of another webapp on a per-request basis. To to that end, I'm using ApplicationManager.CreateObject to create new AppDomains running the web app in question, but the new app domains seem to be failing to load the Dispatcher's DLL (and I'm copying the DLL over to the web app's bin directory, so I'm pretty sure it's there).

[code]....

The Appbase seems to be pointing at the root of the development server, rather than the path passed in to ApplicationManager.CreateObject and it only seems to be searching directories under the development server which seems strange. how to make the new AppDomain search for the DLL in the web app's root rather than under the development server?

View 1 Replies

Configuration :: Aspnet_wp.exe Is Not Working - Failed To Initialize The AppDomain

Jun 18, 2010

I have developed website using .NET 2.0 and I am trying to host the same on IIS 5.1. It works on my machine where I am domain user with all the administrator rights on my machine. I can access the website from other machine on the network using IP address of my machine in URL

But it fails when I am trying to host on my clients machine. Here is the list of errors I get.

I already tried using

1. iisreset
2. aspnet_iis -i

Here is the list of the errors that I get

[Code]....

View 2 Replies

Read Assembly Guid Without Locking DLL In Appdomain In Medium Trust

May 27, 2010

Is it possible to read the GUID from the Assembly without actually loading it in the current App Domain. Normally Assembly.Load loads the DLL into the app domain. I just want to read the value. The description of the GUID is

'The following GUID is for the ID of the typelib
' if this project is exposed to COM
<Assembly: Guid("DEDDE61CD-928E-4ACD-8C25-3B8577284819")>

The main thing is I don't want to lock the file so that there are no errors 'Another process is accessing the file' error.

View 6 Replies

C# - Late Binding In Child AppDomain - Develop A Plugin Architecture

Oct 1, 2010

I am trying to develop a plugin architecture in .Net. The application will be a .Net application. There will be directories which holds the plug-ins. Each directory will represent a plugin. Each plugin directory will also contain all the dependency dlls as well. The plugins need to be stored in separate AppDomain as the plugins may use the same assemblies, but different versions. As it iterates through the foreach loop in Init(), I get a System.IO.FileNotFoundException : Could not load file or assembly '[Assembly Name], Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.in _apDomain.Load() for assemblies that are not in the main project.

readonly private AppDomain _appDomain;
internal ItemModuleAppDomain()
{
AppDomainSetup info = AppDomain.CurrentDomain.SetupInformation;
_appDomain = AppDomain.CreateDomain("ChildDomain");
}
public void Init(string dllDir)
{
string[] dlls = Directory.GetFiles(dllDir, "*.dll", SearchOption.TopDirectoryOnly);
foreach(string dll in dlls)
{
_appDomain.Load(AssemblyName.GetAssemblyName(dll));
}

View 1 Replies

AJAX :: Display Light Box Loading Image On Page When Update Panel Is Loading

Mar 6, 2013

I have update panel on the page to avoid postback and placed a dropdownlist control within that update panel. DrodownList is filled with Category names and also it's autopostback set to True.

Now whenever dropdownlist index change's on select, untill page loads complete  data it should show mesage as "Loading.... in center and middle of the page and background should become bit transparent". And when page load completely with data then that background and message should get disappear.

View 1 Replies

Crystal Reports :: How To Loading Gif Image While IE Progress Bar Start Loading

Apr 3, 2010

i have developed my asp.net application along wih crystal report .... i need to show loading image on ever client and server side request .... (i.e) like when ever IE progress bar get loading i want to show my gif loading ... after IE progress bar finish its loading, my gif loading image should disappear .

View 2 Replies

Parser Error: Could Not Load Type "x" From Appdomain From Within Virtual Directory In IIS7

Aug 4, 2010

I have a parent web application, called Parent, and a second web application called Child. Child is a virtual directory in IIS7 under Parent which is an application in IIS. Child is not a child directory of parent in the file system, only in IIS as a virtual directory. On application loading (Application_Start in global.asax) in the parent web application i tell it to load the child web dlls from childs bin folder using Assembly.LoadFrom() loading it into the app domain of Parent. Then when i try to visit /Child/Default.aspx I get an error saying: Parser Error Parser Error Message: Could not load type 'Child._Default'. Now the Child.dll (the web dll containing childs code behind etc) is in the app domain of the parent application and i can successfully reflect it and its members from code behind in the Parent page Default.aspx.

Furthermore on the Child/Default.aspx if i change the Inherits="Child._Default" to Inherits="System.Web.UI.Page" and then in <% %> tags on the page enumerate the dlls in the app domain i can see Child.dll and reflect its members and invoke functions. One thing that works is changing CodeBehind to CodeFile in the page directive. Then the page parses correctly. However this only works when the websites are in uncompiled, non published form.

View 1 Replies

Want To Display A Loading Animation While Page Is Loading

Jun 23, 2010

I want to display a loading animation while my page is loading, and when loading is complete then obviously hide it.

I am working in ASP.NET using Masterpages, just wondering there is a a simple way of doing this using JQuery?

View 3 Replies

Windows - .NET Web Page Loading - The First Page Loading Fails With HTTP 404 Error?

Jan 18, 2011

We have installed a web site written by others which is compiled with Visual Studio 2008 and hosted in Windows server 2008 R2.

The IIS connection timeout is set to 120 seconds. But for some pages, the first page loading fails with HTTP 404 error but sequential refresh can bring the page up. The same problem happens for some images which fail to load in web pages. We are not very sure it is network related issue or hosting issue.

View 1 Replies

How To Separate Userlist Into Pages

Nov 22, 2010

I have a list of users on my MSSQL database that I want to display on a page. But it's like 500 users and it takes a little while to load it. How can I get started with making it create seperate sets of user so that it has like a page 1 page 2 etc?

The list is not bound to a server control, I am just getting the data using JSON from JQuery AJAX so theres not really much ASP.Net involved at this point, except that the JQuery calls WebMethods in the code behind. The table is then created using Javascript.

View 6 Replies

SQL Server :: Separate Web & Database?

Nov 4, 2010

Currently, we have our ASP.NET applications running on windows server 2003. All of our data resides on an IBM ISeries / AS400. The 400 people are going to be creating massive new tables with millions of records. Because of this, I've been asked to look into the idea of putting new ASP.NET pages on the IBM ISeries server. This server uses APACHE. I have read that to do this, I will need to use the Mod_Mono Apache module. I would like to come up with a list of benefits and drawbacks to this new idea. Initially, it seems like this is a bad idea for a few reasons:

Security: if a users gets unauthorized access to our local server(s), they will only have access to either DB or web server, not both. Maintainability: Microsoft ASP.NET is easier to implement on a Microsoft Windows Server. Problem Solving: I will have to first determine if an issue is due to the ISeries server, or the Apache server, or the ASP.NET application. This could be countered by saying that I would already have to determine if the issue is due to Windows server, or ASP.NET application. However I have better experience with troubleshooting on a windows box that I am familiar with.

Problem Creating: I could escentially create a problem that not only takes down the web server, but the database as well, and other RPG programs running on the ISeries. Resources: The database server will not have to server my application, it will only have to retrieve the data for it.

Drivers: The windows server already contains many drivers and .DLL's that are used... will these even exist on the ISeries? How easy (if even possible) would it be to get them on the ISeries if they dont exist..? A few positive thoughts: The application will reside on the same server as the data, thus, it may be quicker at retrieving data from these millions of records in a table. This was the main point as to why I should look into this possibility. Single point of failure. We no longer have to worry about two servers going down and causing this application to be unavailable...

View 3 Replies

Using Shared Function In A Separate DLL

Jan 18, 2011

I have CMS and FAQ as 2 different modules/projects each uses a different DLL file. When those two modules was structured as the same application. I was using the following piece to get the FAQs categories as part of my menu

[Code]....

Now those two modules are separated. .. Can I use the following shared function which is already exist in the FAQ separate DLL to loop the categories? and how can I do it?

[Code]....

View 5 Replies

Specify Different Level To Separate Appenders?

Jun 14, 2010

For Log4Net used in ASP.NET, how do I specify specify different levels to separate appenders in web.config?

View 2 Replies

.net - Two Web Applications In The Same Solution - How Can I Keep Them Separate?

Mar 22, 2010

I have two web applications in the same solution.They both use different membership/profile and role providers.They are named differently. When I run the solution, and visit one website, and login everything is fine.I then go to the other website, it thinks I am already logged in and the profile provider tries to load profile properties that do not exist.How can I keep them separate, so when I try to log in on one site, it doesn't think I'm still logged in on the other.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved