.NET Framework - Execute dlls in seperate process
Asked By Michaelov, Itzik
24-Jan-10 02:48 AM
Hi
I have .NET dll written in C#
it is have a many classes and have many clients that use this dll.
Now i have request to run this dll out-of-process without change the
clients!
I do not know if there is simple way to do it (like in VB6 just to change dll
to ActiveX EXE)
Any suggestions ?
Thanks
System.EnterpriseServices
(1)
AppDomain
(1)
WCF
(1)
Otherwise
(1)
Execute
(1)
ActiveX
(1)
Michaelov
(1)
Arne
(1)
Peter Duniho replied to Michaelov, Itzik

Is it a COM DLL? If so, then I suppose there may be a way to configure
it as an out-of-proc COM server. That's outside the scope of this
newsgroup though; more of a COM question, than a C#/.NET question.
Though surely the solution will involve some change to the C# project,
to get the output appropriate for an out-of-proc COM server (i.e. change
it from DLL to EXE, in addition to the COM-related changes that have to
be made).
Otherwise, no. A DLL assembly inherently is intended to be used in the
context of some other executable that loads it. You can always wrap the
DLL in some EXE code of course, and define some API by which a different
process can interact with it. But whether you would consider that "simple",
I do not know (the API does not have to be complicated, necessarily, but
it is not going to be trivial either).
Of course, the request begs the question: what benefit does your client
expect to achieve by running your DLL code as a standalone process?
Not that such things are unheard of. One possible use scenario would be
to have a single process that can act as a server for multiple other
client processes, to address some specific need to have the handling of
the multiple client processes coordinated somehow. But generally, one
would expect things to be _better_ running the code as a DLL rather than
a standalone EXE.
IMHO you should work to understand the client request better, so you
know what is the underlying goal they are trying to achieve. Just as
often in this newsgroup, we get questions from programmers who ask about
some specific implementation, when what they really need is advice about
whatever design led them to that implementation choice, clients of
third-party code may often ask for some specific change to the
third-party code, when in fact what they really need is advice as to how
to change their overall architecture to fit within a more sane usage of
the third-party code.
I think there is a good chance your client does not really need your DLL
code to run in its own process.
Pete
Patrice replied to Michaelov, Itzik
Hello,
Perhaps http://msdn.microsoft.com/en-us/library/3x7357ez(VS.71).aspx
(System.EnterpriseServices) or if acceptable using an EXE rather than a DLL
should likely work
They just want the isolation brought by running out of process or do they
have a more specific goal ?
--
Patrice
Arne_Vajhøj replied to Michaelov, Itzik
You need to create another DLL that is used in process that
communicates with another process that calls the original DLL.
If the DLL is not signed it should be easy to replace.
For communicating with the other process you can use
COM+, remoting or WCF.
Any chance you can persuade whoever is in charge to
go for other AppDomain instead of other process?
I think that would simplify the solution and would
provide sufficient isolation for most usage.
Arne

System; using System.Text; using System.Threading; public class Program { static void Main(string[] args) { AppDomain domain = AppDomain.CreateDomain("SecondDomain"); Thread.CurrentThread.Name = "Thread 2"; / / / / Thread.Start in first domain Thread thread = new Current thread, for simpliicty, second domain / / / / The CrossAppDomainDelegate is a good tool for threading across appdomain / / / / boundaries. domain.DoCallBack(new CrossAppDomainDelegate(SomeMethod)); for (int i = 0; i < 10; i++) { Console.WriteLine 1000); } Console.ReadLine(); } static void SomeMethod() { int tal = 10; int sum = 10; Console.WriteLine("Domain: " + AppDomain.CurrentDomain.FriendlyName); Console.WriteLine("Thread: " + System.Threading.Thread.CurrentThread.Name); Thread.Sleep(2000); tal = 0; sum = sum / tal; } } / / Tony C# Discussions CrossAppDomainDelegate (1) DoCallBack (1) AppDomain (1) Exception (1) Class (1) ExecuteAssembly (1) CreateDomain (1) Application (1) You execute the code in the second domain in your original thread. Perhaps you could explain why it is you a) think that the new thread is executing in the new AppDomain (it is not), and b) why you think that an exception in the new AppDomain will not propagate back up to the caller in the original AppDomain, thus stopping the
Error when trying to call Oracle hosted service from WCF .NET Framework Hello, Some time ago I started a topic on MSDN forums: http: / / social.msdn.microsoft.com / Forums / en-US / wcf / thread / ebf301cd-ab4a-49bc-b74f-1c4a0dbf92f8 I thought, that as an MSDN subscriber I can mainly for information, if the error I am getting is related to some bug in WCF, or maybe I am doing something wrong. After getting an answer, I will update the can benefit as well. Regards, Arek Dygas .NET Web Services Discussions BFFBF1CEContent (1) Oracle (1) WCF (1) Encoding (1) Thread (1) MessageEncoder (1) Serif (1) Neccessary (1) - -- -- - = _NextPart_0001_51228811 Content-Type: text Thanks for your posting. Yes, I have found the thread you posted originally in the WCF forum. Due to the support limitation in the newsgroup and forum, I think the problem bb266240.aspx Sincerely, Steven Cheng - -- -- -- -- -- -- -- -- -- - Subject: Error when trying to call Oracle hosted service from WCF Date: Wed, 3 Mar 2010 01:02:01 -0800 Hello, Some time ago I started a topic on MSDN forums: http: / / social.msdn.microsoft.com / Forums / en-US / wcf / thread / ebf301cd-ab4a-49bc- b74f-1c4a0dbf92f8 I thought, that as an MSDN subscriber I can mainly for information, if the error I am getting is related to some bug in WCF, or maybe I am doing something wrong. After getting an answer, I will update the
is the best way invoke the second half of the transaction ? I am thinking maybe WCF ? Any advice on specifics would be appreciated ! VB.NET Discussions XmlDoc.DocumentElement.SelectNodes (1) SQL it is hard to give. However, a direct interface to an Erp System by instance WCF has never worked for me. I would probably create an extra table with the records your solution and the Erp System done by different disciplines, by doing it with an WCF you have direct another group to satisfy. JMO Cor Well, maybe I have overcomplicated the even without having it return results) ? Kind of like "blind" transacting ? When I read about WCF I thought that it may be the answer, but I am not familiar enough with to pass to the COM object out of a queue. You can also have a WCF method dumped transactions into the queue. it is an async call to the SQL Server Service Broker with the WCF returning to the client - - not waiting, but data is in the queue guaranteed to be likelyhood the original trans would be lost. That's why I pointed you to a WCF solution that writes the orginal transaction out and commits them, and then it calls a be the case. . . So the SQL service broker "is using" or "is built upon" the WCF ( sorry I am new to this piece ) ? Which books do you like on the SQL
Hosted Service on MF (DPWS) communicating with a WCF Client .NET Framework Hi, again a DPWS related question from me . . . . Consider the following scenario an MF Device (actually it is the Emulator) and I would like to have a WCF (4.0) client consuming that service. I do not want to use the (new) discovery features of WCF (since they will only work within the same subnet and might cause problems when going the latest release? Can anyone provide a working example of a MF-Service and a WCF-Client? Below are my results / problems - maybe somebody has some suggestions? Regards, Tim When I try to implement a WCF-client "talking" to my MF Service, I get the following error (Hosting the service on the MF Emulator of VS2009 and running the client in VS2010; MF 4.0, and WCF 4.0) when trying to call a service operation on the client proxy. The header IP: 0160] #### Ws.Services.Transport.WsThreadManager+MessageProcessor::ProcessRequest [IP: 0007] #### My app.config (for the WCF-client) looks like the following: maxWritePoolSize = "16" messageVersion = "Soap12WSAddressingAugust2004" writeEncoding = "utf-8"> maxArrayLength = "16384" .NET Microframework Discussions Regards Lorenzo Tim G (1) Exception (1) Date (1) Bit (1) WCF (1) Hello Manuel M (1) ProcessRequest (1) Hosting (1) The first exception seems to be
assembly / GAC_MSIL / System.Windows.Forms.resources / 2.0.0.0_de_b77a5c561934e089 / System.Windows.Forms.resources.dll. - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - System.EnterpriseServices Assembly-Version: 2.0.0.0. Win32-Version: 2.0.50727.4927 (NetFXspW7.050727-4900). CodeBase: file: / / / C: / Windows / assembly / GAC_32 / System.EnterpriseServices / 2.0.0.0_ _b03f5f7f11d50a3a / System.EnterpriseServices.dll. - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - System.resources Assembly-Version: 2.0.0.0. Win32-Version: 2.0.50727.4927