Reputation: 463
I'm very new to Spring, so some decisions are not clear for me
This is ASP.NET MVC4 / .NET 4.5 application
This is a text of exception:
An exception of type 'System.Configuration.ConfigurationErrorsException' occurred in Spring.Core.dll but was not handled in user code
Additional information: Error creating context 'spring.root': Request is not available in this context
Error throws in custom Context manager class:
public static IApplicationContext GetApplicationContext()
{
if (null == appContext)
{
lock (typeof(ContextManager))
{
if (null == appContext)
{
appContext = ContextRegistry.GetContext(); <-- throws there
}
}
}
return appContext;
}
Lots of solutions, I'd googled, tells me to switch IIS Mode to Integrated Mode. In that mode application works fine, but I need to debug app with IISExpress. And there are no any ideas
There is my stack trace for this exception:
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.HttpContext.GetSection(String sectionName)
at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)
at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at Spring.Util.ConfigurationUtils.GetSection(String sectionName)
at Spring.Context.Support.ContextRegistry.InitializeContextIfNeeded()
at Spring.Context.Support.ContextRegistry.GetContext()
at HealthDec.Cms.Model.ContextManager.GetApplicationContext() in ~~\Model\ContextManager.cs:line 46
at HealthDec.Cms.Model.ContextManager.GetObject(String name) in ~~\Model\ContextManager.cs:line 64
at HealthDec.Cms.WebApp.MvcApplication.Init() in ~~\Applications\WebApp\Global.asax.cs:line 156
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
Upvotes: 3
Views: 1445
Reputation: 463
Solution Explorer -> Select MVC project -> Properties tab -> Managed Pipeline Mode -> Integrated <--> Classic
Upvotes: 3