remoting

Passing values back and forth appdomains

◇◆丶佛笑我妖孽 提交于 2019-12-30 06:13:08
问题 I have the following code: public class AppDomainArgs : MarshalByRefObject { public string myString; } static AppDomainArgs ada = new AppDomainArgs() { myString = "abc" }; static void Main(string[] args) { AppDomain domain = AppDomain.CreateDomain("Domain666"); domain.DoCallBack(MyNewAppDomainMethod); Console.WriteLine(ada.myString); Console.ReadKey(); AppDomain.Unload(domain); } static void MyNewAppDomainMethod() { ada.myString = "working!"; } I thought make this would make my ada.myString

Mixing MarshalByRefObject and Serializable

 ̄綄美尐妖づ 提交于 2019-12-30 04:46:06
问题 Various sources explain that When an object derives form MarshalByRefObject, an object reference will be passed from one application domain to another rather than the object itself. When an object is marked with [Serializable], the object will be automatically serialized, transported from one application domain to another and then deserialized to produce an exact copy of the object in the second application domain. Note then that while MarshalByRefObject passes a reference, [Serializable]

How to pass an unknown type between two .NET AppDomains?

拥有回忆 提交于 2019-12-30 03:26:08
问题 I have a .NET application in which assemblies in separate AppDomains must share serialized objects that are passed by value. Both assemblies reference a shared assembly that defines the base class for the server class and also defines the base class for the entiy type that will be passed between domains: public abstract class ServerBase : MarshalByRefObject { public abstract EntityBase GetEntity(); } [Serializable] public abstract class EntityBase { } The server assembly defines the server

What Windows Class to use when I want to start a process remotely

回眸只為那壹抹淺笑 提交于 2019-12-29 08:23:14
问题 I want to use c# and WMI to start a process remotely in another computer. I've made some initial research and found out that i ultimately have to use a processclass. The "Win32_Process" was the first thing that seemed obvious to be used, however, it seems it is limited to represent only local processes. What other Windows process classes can I use? Here is what the code when using Win32_ScheduledJob class: static public String RemoteConnect() { try { ConnectionOptions conn = new

RemotingAppender problems. Conn created but nothing appended

喜夏-厌秋 提交于 2019-12-25 07:01:55
问题 I have been learning log4net and wish to use the remoting appender to log messages onto a server sometime in the future. To do this, I first tried creating a local .Net remoting server and appending to it. It seems to me that the server has been created but I cannot receive these messages. (To check this, I try accessing the server by entering localhost:portnumber in my browser, before and after running my program. It fails before and accepts the connection later. Any better way to debug this

RemotingServices.Marshal(foo, uri) only works for a short period of time. How to keep it working?

。_饼干妹妹 提交于 2019-12-25 05:45:19
问题 When I do RemotingServices.Marshal(foo, uri); And the Client connects, everything works. When I wait for a few minutes and then try to connect the client, the Client throws a RemotingException: Object '{name of service}' has been disconnected or does not exist at the server. What happens here? Is there a timeout of some sort? 回答1: To avoid timeouts, you can add to your remoted object the following overridden method: public override object InitializeLifetimeService(){ return null; } 来源: https:

Invoke-Command returning data

亡梦爱人 提交于 2019-12-24 10:31:20
问题 I am working on a script to query remote servers for configuration information and return the data for output to gridview. The issue I am having is the format in which the data is returned. If I do... ((Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors | Measure-Object).Count ((Get-CimInstance -ClassName Win32_PhysicalMemory).Capacity | Measure-Object -Sum).Sum /1GB in a ps1 and run that on a remote server using Invoke-Command, I get an array back with only numbers like

Spring remoting/webservice technologies

我的未来我决定 提交于 2019-12-24 08:12:16
问题 Spring Framework provides many technologies for applications to communicate with each other over HTTP. HTTP Invoker RESTful MVC Controller JAX-WS Spring-WS What are the differences among them? What criteria dictate which one to choose? 回答1: JAX-WS is a standard maintained by the JCP (Java Community Process) and every full featured application server implements it (or, at least, provides an implementation for it). It's easy to use (you just need a few annotations in your service class endpoint

Sponsor's Renewal function stops being called

大憨熊 提交于 2019-12-24 06:58:09
问题 I have a server and client process both running on the same machine. The client creates a CAO object and uses it for some time (<1s up to hours). It takes a lot of memory so I want to dispose of this object as soon as possible after the client finishes with it. I set InitialLeaseTime and RenewOnCallTime to 10s (0.1s and 15s have the same problem). I can see that for a few minutes, the sponsor's Renweal functon is being called every 10s. After several minutes the client starts doing different

Why can't I subscribe to an event in a partial-trust AppDomain?

落花浮王杯 提交于 2019-12-24 01:19:54
问题 In my default (full-trust) AppDomain I want to create a sandbox AppDomain and subscribe to an event in it: class Domain : MarshalByRefObject { public event Action TestEvent; } Domain domain = AppDomainStarter.Start<Domain>(@"C:\Temp", "Domain", null, true); domain.TestEvent += () => { }; // SecurityException Subscription fails with the message "Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0...' failed." (For the definition of