如何从WCF服务访问ServiceHost对象

编程入门 行业动态 更新时间:2024-10-11 03:17:05
本文介绍了如何从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对象

本文发布于:2023-11-13 04:43:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583462.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对象   WCF   ServiceHost

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!