2.0 Bata Request is not available in this context

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Request is not available in this context    2.0 Bata    .

  
ii7.5    Classic mode  Ok !
           Integrated      error !!!
12 years ago
You need to use ASP.NET 4.0 Integrated Pipeline
12 years ago
I've got the same issue with the latest version (e4a013066b47) from codeplex... it seems to occur when the application is starting...

I've updated this with the full stack trace...
... also it was working fine with the Nop 2.0 Beta version (bdcdd5b244ad).

Running in IIS 7.5 (7.5.7600.16385 - Windows 7 Professional) : Integrated Mode (both debug and release mode)

Server Error in '/' Application.
Request is not available in this context
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Request is not available in this context

Source Error:

Line 62:                 //in this case return built-in customer record for search engines
Line 63:                 //or comment the following two lines of code in order to disable this functionality
Line 64:                 if (_webHelper.IsSearchEngine(_httpContext.Request))
Line 65:                     customer = _customerService.GetCustomerBySystemName(SystemCustomerNames.SearchEngine);
Line 66:


Source File: C:\Projects 2011\Catfish\NopCommerce\Libraries\Nop.Services\WorkContext.cs    Line: 64

Stack Trace:

[HttpException (0x80004005): Request is not available in this context]
   System.Web.HttpContextWrapper.get_Request() +11442684
   Nop.Services.WorkContext.GetCurrentCustomer() in C:\Projects 2011\Catfish\NopCommerce\Libraries\Nop.Services\WorkContext.cs:64
   Nop.Services.WorkContext.get_CurrentCustomer() in C:\Projects 2011\Catfish\NopCommerce\Libraries\Nop.Services\WorkContext.cs:199
   Nop.Services.WorkContext.get_WorkingLanguage() in C:\Projects 2011\Catfish\NopCommerce\Libraries\Nop.Services\WorkContext.cs:226
   Nop.Web.Framework.NopResourceDisplayName.GetResource(String resourceKey) in C:\Projects 2011\Catfish\NopCommerce\Presentation\Nop.Web.Framework\NopResourceDisplayName.cs:20
   Nop.Web.Framework.NopResourceDisplayName..ctor(String resourceKey) in C:\Projects 2011\Catfish\NopCommerce\Presentation\Nop.Web.Framework\NopResourceDisplayName.cs:10
   System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0
   System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +77
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1286
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType) +149
   AutoMapper.ConfigurationStore.CreateMappingExpression(TypeMap typeMap) +238
   Nop.Admin.Infrastructure.AutoMapperStartupTask.Execute() in C:\Projects 2011\Catfish\NopCommerce\Presentation\Nop.Web\Administration\Infrastructure\AutoMapperStartupTask.cs:61
   Nop.Core.Infrastructure.NopEngine.RunStartupTasks() in C:\Projects 2011\Catfish\NopCommerce\Libraries\Nop.Core\Infrastructure\NopEngine.cs:59
   Nop.Core.Infrastructure.NopEngine.Initialize(NopConfig config, Boolean databaseIsInstalled) in C:\Projects 2011\Catfish\NopCommerce\Libraries\Nop.Core\Infrastructure\NopEngine.cs:103
   Nop.Core.Infrastructure.EngineContext.Initialize(Boolean forceRecreate, Boolean databaseIsInstalled) in C:\Projects 2011\Catfish\NopCommerce\Libraries\Nop.Core\Infrastructure\EngineContext.cs:27
   Nop.Web.MvcApplication.Application_Start() in C:\Projects 2011\Catfish\NopCommerce\Presentation\Nop.Web\Global.asax.cs:48

[HttpException (0x80004005): Request is not available in this context]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4052901
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Request is not available in this context]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11688784
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4864581


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.450


Running in Cassini
Works fine

Not sure what is happening...

Anyone else having issues?
12 years ago
Do anybody else experience this issue in IIS 7.5?
P.S. I don't have IIS 7.5 installed, so can't replicate it
12 years ago
Bump!

I've updated the stack trace in my previous reply. The stack trace seems to be indicating some kind of issue which is being fired on startup by AutoMapper, which is reflecting some of the assemblies and then calling a get property on Nop.Services.WorkContext.get_WorkingLanguage() which needs the HttpContext, which is not available in IIS 7.5 Integrated mode.

Just out of interest, what is the deployment server supposed to be configured to... IIS 7.5 Inegrated right? or have I just assumed this and got it wrong?
12 years ago
Hmmm.... I have found out what was causing the issue but I could do with a bit of a hand working out why this is occuring.

The story so far...
The Nop 2.0 Beta (bdcdd5b244ad) release worked ok for me in IIS 7.5 Integrated mode.

I got "Change Set e4a013066b47" and this (or as it turned out a different change) was causing the fatal error (in earlier post).

I hunted around for changes related to AutoMapper and found "Change Set 1fb5e0cfa1b1".
This replaced some of the Automapper dlls with another version (not sure what version of Automapper this is btw - custom version of automapper - how is it a custom version? Is there source code for this? The latest version from codeplex of Automapper is 1.1 (this DLL is version 2.0... what gives?)).
I reverted this change and put the references back to the "Packages\AutoMapper.1.1.0.118" version.

It now doesn't have the error... but I have another perculiar error... for some reason IIS can't seem to serve the main style sheet?

/Themes/DarkOrange/Content/styles.css - 404

I traced this to "Change Set e387c30220b7"
This change added a web.config file to the /Themes directory which was blocking serving the files... ?

Can you guys give me some feedback on this? Also... I guess this post should really be in the bugs forum.

Also, a quick question, do you guys test with IIS 7.5 or just Cassini or IIS 6?

Cheers.
12 years ago
Sorry, my English is not good, I know this is caused by the mechanism of IIS.

Will be fixed?

http://mvolo.com/blogs/serverside/archive/2007/11/10/Integrated-mode-Request-is-not-available-in-this-context-in-Application_5F00_Start.aspx

http://learn.iis.net/page.aspx/381/aspnet-20-breaking-changes-on-iis-70/
12 years ago
Thanks for info. I've just moved back to original Automapper. Could you please try the latest version and confirm whether everything is OK now?
12 years ago
Yep, that fixes the compilation issues with Automapper.

I still have the issue with the Nop.Web/Themes/web.config file which I described in the previous post.
So, to recap, if you are totally missing styles then this is the cause.
12 years ago
verymadbob wrote:
for some reason IIS can't seem to serve the main style sheet?

/Themes/DarkOrange/Content/styles.css - 404

Could you please get the latest version (CodePlex) and confirm that the issue is fixed?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.