Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Httpcontext is null?

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

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

enviroment : Application Domain.

inside it theres Application Runtime.

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

HttpApplication with each has httpContext which handler Response and Request.

enter image description here

So what does it mean when i get in asp.net HttpContext is null ?

like image 786
Royi Namir Avatar asked Jul 22 '26 04:07

Royi Namir


1 Answers

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

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

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

like image 103
Davide Piras Avatar answered Jul 23 '26 20:07

Davide Piras



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!