appdomain

Caching is not being clear on site restart

六月ゝ 毕业季﹏ 提交于 2019-12-07 06:45:11
问题 I am using singleton pattern to load some configurations which are in database. If I add some new configurations in database and restart the webservice then it doesn't load those settings. For this If I do restart the IIS server then it works fine. I am not sure where does it reside?Is it loaded in App Domain and I need to restart AppDomain also? I m not clear why this is happening. Because if I restart the service from IIS it should clear all the information from app domain too but not

What's the recommended way to run plugins with dependency dll's that have different version?

纵然是瞬间 提交于 2019-12-07 06:02:43
问题 I have a WCF plugin service that loads plugins via MEF and runs them. Each plugin is a directory with multiple dll's that implements a specific interface. I load all the plugins in the same AppDomain using MEF ( DirectoryCatalog ) and run them in a generic way (using reflection). Now lets assume I have two plugins with dll dependencies: Plugin1 ----> Entities 1.0.0.1 Plugin2 ----> Entities 1.0.0.2 I've added some new entities in 1.0.0.2. When I run the plugin's I get a sporadic error that the

Error while unloading appdomain. (Exception from HRESULT: 0x80131015), inside Windows Service

一个人想着一个人 提交于 2019-12-07 03:38:42
问题 I receive this error in a windows service. This is the same service that I've previously discussed in my question here The code is revised to use Parallel.ForEach (my own version as this is a 3.5 windows service). The reason for the Parallel use is down to the fact that it simply took too long to Unload each domain and running them in parallel should prove to be faster (appears to be even though there is only one thread that's doing each Unload?!). Based on other posts, I can only guess that

webapi and unhandled exception hook per appdomain

不问归期 提交于 2019-12-07 03:30:31
Having a WebApi 2.2 application - is it possible to make use of AppDomain's UnhandledException hook? I have a code similar to this: [assembly: OwinStartup("DevConfiguration", typeof(DevStartup))] namespace WebApi.Module { public class DevStartup { private const string ErrorEventSourceName = "WebApiHost"; private const int ErrorEventId = 600; [SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlAppDomain)] public void Configuration(IAppBuilder app) { AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException; ... throw new Exception("some exception); }

How to pass a variable from one app domain to another

梦想与她 提交于 2019-12-06 17:48:22
问题 I'd like to know, if I have a variable,for example, a string, how to pass its value to my new app domain: static string _str; static void Main(string[] args) { _str = "abc"; AppDomain domain = AppDomain.CreateDomain("Domain666"); domain.DoCallBack(MyNewAppDomainMethod); AppDomain.Unload(domain); Console.WriteLine("Finished"); Console.ReadKey(); } static void MyNewAppDomainMethod() { Console.WriteLine(_str); //want this to print "abc" } Thanks 回答1: Use one of the variations of AppDomain

Load and unload a dll dynamically into my project using AppDomain

。_饼干妹妹 提交于 2019-12-06 16:15:18
问题 I want to use a class from a different project in a separate solution in my current project dynamically. I thought the solution is to load the dll into my project. I used the following code to do my task and it worked. string dllPath = @"the path of my dll"; var DLL = Assembly.LoadFile(dllPath); foreach (Type type in DLL.GetExportedTypes()) { if (type.Name == "targetClassName") { var c = Activator.CreateInstance(type); try { type.InvokeMember("myMethod", BindingFlags.InvokeMethod, null, c,

Passing an unmanaged pointer between two AppDomains (By indirect call)

时光总嘲笑我的痴心妄想 提交于 2019-12-06 15:18:22
.NET 4.5, 64bit Win8 I have two MSMQ running under WCF and hosted under Windows Activation Service. Execute MSMQ: Responsible for calling an unmanaged function and obtaining a pointer IntPtr to 4GB array in addition to other limited size variables. This array is not that important and shouldn't be blocking the queue until it is passed to the DB and having this queue free is a priority. Passing the pointer to the Save MSMQ (Hypothesis). Save MSMQ: Should save the array to the DB across the network then deallocate it from unmanaged memory. The problem here would be: Making sure the array is

Is it possible to have delegates marshalled as proxies when they are passed across to another AppDomain?

微笑、不失礼 提交于 2019-12-06 14:33:03
Somehow I assumed that delegates passed to another AppDomain would turn into a proxy as if it were an object derived from MarshalByRefObject . Unfortunately, it seems they don’t. Let’s say in my code I have a class MyClass like this: [Serializable] public sealed class MyClass { public Func<Input, Output> SomeDelegate; } [Serializable] public sealed class Input { ... } [Serializable] public sealed class Output { ... } Now I need to pass an instance of MyClass to another AppDomain. The problem is that the delegate stored in SomeDelegate may contain a reference to pretty much any method,

WPF warm AppDomain startup performance (Application.RunInternal, XamlReader.LoadBaml)

纵然是瞬间 提交于 2019-12-06 14:22:04
I have relatively simple application, but warm (second, etc.) start-up time is awful 3-5 seconds. Profiler (VS2010, CPU Sampling) shows that more than 80% of time is spent in Application.RunInternal (~40%) and XamlRader.LoadBaml (~40%) functions. The root of the problem is that Window is created in non-default AppDomain. If I move Window creation to default AppDomain or give AppDomain unrestricted permission set everything is as fast as expected. I'm testing on: Windows Seven x64 .Net 4.0 4Gb RAM GeForce 9800GT 1Gb. I'm creating AppDomain this way var permissionSet = new PermissionSet(null);

Why does AppDomain.Unload() error in finalizer?

不羁岁月 提交于 2019-12-06 14:06:16
Here's some sample code: using System; namespace UnloadFromFinalizer { class Program { static void Main(string[] args) { Program p = new Program(); } AppDomain domain; Program() { this.domain = AppDomain.CreateDomain("MyDomain"); } ~Program() { AppDomain.Unload(this.domain);//<-- Exception thrown here } } } I have a class that creates an AppDomain in the constructor to be used over the lifetime of the object. I'd like to properly cleanup the AppDomain, so I thought I would call Unload in the finalizer. Unfortunately, that causes a CannotUnloadAppDomainException to be thrown. The MSDN