I have my webservice running on IIS in Integrated mode. In this mode, HttpContext.Request
throws exception, when is called from Application_Start
method.
// app is HttpApplication
var serverName = app.Context.Request.ServerVariables["SERVER_NAME"];
The above statement would throw System.Web.HttpException: Request is not available in this context
Is there somewhere else, where I can retrieve ServerVariables from, within Application_Start
?
You can use
HostingEnvironment
It has a lot of properties you can use