如何从WCF服务访问ServiceHost对象 [英] How to access the ServiceHost object from the WCF service

查看:60
本文介绍了如何从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.com


" 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.com

"Chris Bordeman"
<RE*********************************************** ***@hhoottmmaaiill.com>
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.com写在

消息新闻:eV ************** @ TK2MSFTNGP02.phx.gbl ...
I guess, kind of a newbie tho, how do I access OperationContext?

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:eV**************@TK2MSFTNGP02.phx.gbl...

Chris,


你不应该直接访问ServiceHost。通常,通过

OperationContext,您可以获得所需的信息。


您想要获得的是什么?


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" 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.com

"Chris Bordeman"
<RE*********************************************** ***@hhoottmmaaiill.com>
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!!!




这篇关于如何从WCF服务访问ServiceHost对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆