appdomain

Best evidence to offer a sandboxed appdomain for a C# evaluator

混江龙づ霸主 提交于 2019-12-04 01:30:04
I have a c# evaluator which uses the (I think) the .Net 4 new simplified sandboxed appdomain model to host the c# assembly, with remoting doing the rest. The call to create the appdomain is Evidence ev = new Evidence(); ev.AddHostEvidence(new Zone(SecurityZone.Trusted)); PermissionSet pset = SecurityManager.GetStandardSandbox(ev); AppDomainSetup ads = new AppDomainSetup(); ads.ApplicationBase = "C:\\Sandbox"; // Create the sandboxed domain. AppDomain sandbox = AppDomain.CreateDomain( "Sandboxed Domain", ev, ads, pset, null); The c# eval is embedded in a server app, but I don't want give the

How to use Castle.Windsor in an assembly loaded using reflection

最后都变了- 提交于 2019-12-03 22:55:35
问题 Let's say I have a library Lib.dll, which uses Castle.Windsor to initialize its services. I have a main application App.exe, which loads Lib.dll on runtime using reflection. App.exe does not know the location of Lib.dll beforehand, it is only known at runtime. In this case, when App.exe loads Lib.dll and Lib.dll initialize its services, a System.TypeInitializationException exception is thrown, because Castle.Windsor cannot find the service type. Castle.MicroKernel.SubSystems.Conversion

IRegisteredObject not working as expected

做~自己de王妃 提交于 2019-12-03 21:39:07
Background I'm working on an ASP.NET 4 web site (not web application). I'm trying to use IRegisteredObject to allow some long-running code to run in a non-request thread. For testing, I've set the IIS 7.5 application pool's recycle interval to low values so that it will try to recycle while the background thread is running. Code public class AspFriendlyBackgroundJob { private readonly object key = new object(); private readonly Task task; public AspFriendlyBackgroundJob(Action work) { lock (key) { HostingEnvironment.RegisterObject(new Stopper(this)); task = Task.Factory.StartNew(work); } }

Copy files over network via file share, user authentication

杀马特。学长 韩版系。学妹 提交于 2019-12-03 19:13:52
问题 I am building a .net C# console program to deploy file to a windows file share server (folder that is being shared). The path is :: \\192.168.0.76\htdocs\public On running I am getting the error: [09:35:29]: [Step 1/3] Unhandled Exception: System.UnauthorizedAccessException: Access to the path '\\192.168.0.76\htdocs\public' is denied. [09:35:29]: [Step 1/3] at DeployFileShare.Program.CopyDir(String source, String dest, String[] exclude, Boolean overwrite) [09:35:29]: [Step 1/3] at

Loading DLLs into a separate AppDomain with known only common interface

僤鯓⒐⒋嵵緔 提交于 2019-12-03 17:12:44
I need to load .dll(plugins) in another domain. In main app I don't know anything about plugins types, only that they implement common interface ICommonInterface with some methods. So this code wouldn't help, because I can't create an instance with interface type. AppDomain domain = AppDomain.CreateDomain("New domain name"); //Do other things to the domain like set the security policy string pathToDll = @"C:\myDll.dll"; //Full path to dll you want to load Type t = typeof(TypeIWantToLoad); TypeIWantToLoad myObject = (TypeIWantToLoad)domain.CreateInstanceFromAndUnwrap(pathToDll, t.FullName); My

FileNotFound when load assembly with dependency to another domain

▼魔方 西西 提交于 2019-12-03 16:58:57
问题 I'm trying to make application with plugins. I have MainLib.dll, where I made some commnon interface(let it be ICommon ) with 1 method. Then, I made 2 .dlls(plugins) which have reference to MainLib.dll and implement the ICommon in some classes. Also, I removed all the references in this .dlls exept System . Then, I created an application, which monitors folder ".\\Plugins" and loads all .dlls in newDomain , check if the types in .dll implement ICommon (so this application also reference to

Why Thread.CurrentContext property and Thread.GetDomain() method?

丶灬走出姿态 提交于 2019-12-03 16:43:00
It's not a question of major importance, but I was wondering why the Thread class exposes a property for getting the current Context ( Thread.CurrentContext ) and a method for getting the current AppDomain ( Thread.GetDomain() ). Knowing the hierarchy of Process > AppDomain > Context > Thread, my assumption would be that the context for thread is known at current point in time, and the domain needs to be searched based on current context. But I'd like to hear wiser answers. Thanks! my assumption would be that the context for thread is known at current point in time, and the domain needs to be

What is the scope of finalizer thread - per application domain or per process?

跟風遠走 提交于 2019-12-03 16:14:13
问题 Based on all my reading there should be one GC thread to invoke all finalizers. Now, the question is what is the scope of this "one" thread - per process or per application domain, as the whole intention of domains is to separate and make "independent" different applications in one process space. I read here: If an unhandled exception occurs in a finalizer the CLR's executing thread will swallow the exception, treat the finalizer as if it completed normally, remove it from the freachable

ASP.NET Web application doesn't unload AppDomains after deploy

元气小坏坏 提交于 2019-12-03 15:25:34
When we deploy our web application we copy all the code to a new directory and then point iis to that new directory. When we do this the number of appdomains increases but never decreases. Also, our Application_End event never seems to fire. For some unknown time, while both sets of AppDomains are still reported by perfmon, the system performs very poorly while % time in GC spikes to 100%. Eventually I recycle the app pool to get the app running smoothly again. Extra piece of info: listing the appdomains shows 2 on my dev machine, but 4 run on the live server... we just have one application

Azure website constantly restarts due to 'Slow Requests' limit

假装没事ソ 提交于 2019-12-03 14:31:06
I have an azure website setup in West-Europe and in Standard mode. Suddenly today at 30 January 2014 03:00 am UTC it started constantly restart the app pool. The ShutdownReason is HostingEnvironment. I have a lot of these events in eventlog.xml: <Event> <System> <Provider Name="W3SVC-WP"/> <EventID>2299</EventID> <Level>3</Level> <Task>0</Task> <Keywords>Keywords</Keywords> <TimeCreated SystemTime="9:14:50 AM"/> <EventRecordID>15807234</EventRecordID> <Channel>Application</Channel> <Computer>RD00155D3A08C6</Computer> <Security/> </System> <EventData> <Data>Worker Process requested recycle due