English 中文(简体)
将物体作为参数通过窗口服务
原标题:Passing an object as a parameter to a windows service

Is there some way to pass an object to a windows service? I know the method myServiceController.Star(string[] arg) but i need to pass a more complex object than a string array. Actually, i don t need the object to be passed as a parameter, what i really needs is that the service can use an object created in a windows forms application. I ve tried using System.Web.Script.Serialization.JavaScriptSerializer.Serialize method to convert the object into a Json but i couldn t because the object contains a circular reference. I also tried using pointers, but i couldn t becouse it is a managed type object.

任何想法可以做些什么?

问题回答

我利用一个数据库在窗户服务与窗户评估之间分享物体,将XML作为编码格式,并自行进行序列化。 有了一个数据库,你可以总结交易中的通信(为锁定),增加伐木场,将表格作为点处理,并有一个方便的地点,如果你必须重新从坠毁中恢复过来,就能够收回。

它完全取决于窗口服务的渠道。 它可以作为网络服务进行聆听,操作一个专有的袖珍/游览,或者(在NET 4.0中)观看一个被绘制的记忆档案或一个名称的管道。

您的问题提到了一种(强力)方法,更像指挥线“主要”方法。 在此情况下,如果是窗户服务的话,你也许会回头看错事。 您不执行一个窗口服务,通过它的论点。

每一种方法都涉及自己的qui。 但是,基本上,你不得不通过参考或价值序列化收集你的数据。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签