阅读从WCF服务全球应用性能 [英] Read Global Application property from WCF Service

查看:156
本文介绍了阅读从WCF服务全球应用性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Global.asax类中使用对象存储数据的应用程序。

I'm using in my Global.asax class the object Application to store data.

Application.Set("data", "test");



现在,在我的WCF服务中,我想要读这个属性。我如何做到这一点?

Now, in my WCF Service, I want to be abble to read this property. How can I do that?

Application["data"];



在调试中,我可以看到我的global.asax被调用(Begin_Request),但在我的webservice的方法,如何访问此应用程序

推荐答案

var yourData=HttpContext.Current.Application["data"];

不管怎么说,如果你将服务器农场部署服务,你可能有问题,应用程序是inProc,每个服务器都有自己的应用程序变量

bear in mind anyway thay if you will deploy the Service on a Server Farm you could have issues as the Application is inProc and each server will have its own Application variable

这篇关于阅读从WCF服务全球应用性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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