Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I come back again because the solution I added with the "Initialize()" function in fact not run really after an other test. So in fact I found a way which runs correctly.</p> <p>The problem of "request is not available in this context" in application_start in your case could be due to the application mode "Integrated" which is new from II7 instead of the Classic mode.</p> <p>To see a good explain you ca go on the Mike Volodarsky's blog <a href="http://mvolo.com/iis7-integrated-mode-request-is-not-available-in-this-context-exception-in-applicationstart" rel="nofollow">IIS7 Integrated mode: Request is not available in this context exception in Application_Start</a> .</p> <p>I copy/paste an extract which could indicate the main reason:</p> <p>" *This error is due to a design change in the IIS7 Integrated pipeline that makes the request context unavailable in Application_Start event. When using the Classic mode (the only mode when running on previous versions of IIS), the request context used to be available, even though the Application_Start event has always been intended as a global and request-agnostic event in the application lifetime. Despite this, because ASP.NET applications were always started by the first request to the app, it used to be possible to get to the request context through the static HttpContext.Current field.* "</p> <p>To solve this you can use a workaround that moves your first-request initialization from Application_Start to BeginRequest and performs the request-specific initialization on the first request.</p> <p>A good example of code is done in his blog :</p> <pre><code> void Application_BeginRequest(Object source, EventArgs e) { HttpApplication app = (HttpApplication)source; HttpContext context = app.Context; // Attempt to peform first request initialization FirstRequestInitialization.Initialize(context); } class FirstRequestInitialization { private static bool s_InitializedAlready = false; private static Object s_lock = new Object(); // Initialize only on the first request public static void Initialize(HttpContext context) { if (s_InitializedAlready) { return; } lock (s_lock) { if (s_InitializedAlready) { return; } // Perform first-request initialization here // // You can use your create profile code here.... //--- s_InitializedAlready = true; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload