本文介绍了如何从WCF服务访问ServiceHost对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。 我创建了一个自定义ServiceHost对象并进行了一系列初始化 。现在我需要从实际的WCF服务 类中访问其中的对象。怎么办呢? 谢谢!!!
Hi all. I created a custom ServiceHost object and did a bunch of initialization there. Now I need to access an object in it from the actual WCF service class. How can this be done? Thanks!!!
推荐答案Chris, 你不应该直接访问ServiceHost。通常,通过 OperationContext,您可以获得所需的信息。 您想要获得的是什么? - - Nicholas Paldino [.NET / C#MVP] - mv*@spam.guard.caspershouse " Chris Bordeman" < RE ******* **************************************** *** *** hhoottmmaaiill> 在消息新闻中写道:%2 ****************** @ TK2MSFTNGP03.phx.gbl ... Chris, You shouldn''t be accessing the ServiceHost directly. Usually, through the OperationContext, you can get the information that you need. What is it that you are trying to get? -- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse "Chris Bordeman" <RE*********************************************** ***@hhoottmmaaiill> wrote in message news:%2******************@TK2MSFTNGP03.phx.gbl... 大家好。 我创建了一个自定义ServiceHost对象并进行了一系列初始化 。现在我需要从实际的WCF服务 类中访问其中的对象。怎么办呢? 谢谢!!! Hi all. I created a custom ServiceHost object and did a bunch of initialization there. Now I need to access an object in it from the actual WCF service class. How can this be done? Thanks!!!
Chris ,$ / b $ b使用服务操作中的OperationContext访问 当前操作执行环境。要访问ServiceHost ,请使用OperationContext.Current.Host。 问候, James Chris, Use the OperationContext from within a service operation to access the current operation execution environment. To access the ServiceHost use OperationContext.Current.Host. Regards, James
我猜,有点新手,我如何访问OperationContext? Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse写在 消息新闻:eV ************** @ TK2MSFTNGP02.phx.gbl ... I guess, kind of a newbie tho, how do I access OperationContext? "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershousewrote in message news:eV**************@TK2MSFTNGP02.phx.gbl... Chris, 你不应该直接访问ServiceHost。通常,通过 OperationContext,您可以获得所需的信息。 您想要获得的是什么? - - Nicholas Paldino [.NET / C#MVP] - mv*@spam.guard.caspershouse " Chris Bordeman" < RE *** ******************************************** *** *** hhoottmmaaiill。 com> 在消息新闻中写道:%2 ****************** @ TK2MSFTNGP03.phx.gbl ... Chris, You shouldn''t be accessing the ServiceHost directly. Usually, through the OperationContext, you can get the information that you need. What is it that you are trying to get? -- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse "Chris Bordeman" <RE*********************************************** ***@hhoottmmaaiill> wrote in message news:%2******************@TK2MSFTNGP03.phx.gbl... >大家好。 我创建了一个自定义的ServiceHost对象并在那里做了一堆初始化。现在我需要从实际的WCF服务类中访问其中的对象。怎么办呢? 谢谢!!! >Hi all.I created a custom ServiceHost object and did a bunch of initializationthere. Now I need to access an object in it from the actual WCF serviceclass. How can this be done?Thanks!!!
更多推荐
如何从WCF服务访问ServiceHost对象
发布评论