HttpContext的是空? [英] Httpcontext is null?

查看:334
本文介绍了HttpContext的是空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

那么,是否可以说,当HttpContext对象为空 - ?所以IIS下跌

Is it right to say that when Httpcontext object is null - so the iis is down ?

我知道,当到IIS的第一个请求(asp.net)应用程序管理器创建

i know that when the first request to iis ( asp.net) the application manager creates

环境:应用程序域

里面那里有应用程序运行时。

inside it theres Application Runtime.

和它里面有块(如果theres更多然后在服务器上的应用程序1)

And inside it there's blocks of (if theres more then 1 application on the server)

HttpApplication的每个都有它的HttpContext处理程序响应和要求。

HttpApplication with each has httpContext which handler Response and Request.

所以,这是什么意思,当我在asp.net中得到的HttpContext为null?

推荐答案

我不认为你可以运行IIS有任何下降ASP.NET应用程序,只是设计:)

I don't think that you can be running any ASP.NET application having IIS down, just by design :)

如果你有一块code的其中 HttpContext.Current 为空你可能不会在Web服务器,但不知何故以另一种方式运行,例如有时,我们类库设计要在Web应用程序中执行,那么有人直接从窗口服务,控制台应用程序或从单元测试项目,当然也参考这些组件没有的HttpContext!

if you have a piece of code where the HttpContext.Current is null you are probably not running in the web server but somehow in another way, for example sometimes we have class libraries designed to be executed within the web application then somebody references those assemblies directly from a windows service, a console application or from the unit test project and of course there is no HttpContext !

Web服务以及,如果从IIS服务应具备的背景下,如果直接与装配基准,而不是Web引用调用,不能达到任何的HttpContext。

web services as well, if served from IIS should have the context, if directly called with assembly reference and not web reference, can't reach any HttpContext.

显示你的失败code和描述在哪里/你如何使用它,我们会看到为什么上下文在这种情况下为null。

show your failing code and describe where/how you use it and we will see why your context is null in that case.

这篇关于HttpContext的是空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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