spring-projects / spring-projects/spring-net

Does Spring.NET support IIS Integrated Pipeline Mode?

Open
#196 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
881
Forks
372
PR merge metrics
No merged PRs in 30d

Description

Issue: I switched from Classic to Integrated and Spring.NET fails with object creation.

Context: I debugged my application and my code is failing inside your library at a ConfigurationManager.GetSection() call.

Note: This was working well in IIS Classic Mode.

The Web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- Config Section -->
  <configSections>
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
    <sectionGroup name="spring">
      <section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web" />
      <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
    </sectionGroup>
  </configSections>
...
    <spring>
      <context>
        <resource uri="config://spring/objects" />
        <objects xmlns="http://www.springframework.net">...</objects>
      </context>
    </spring>

The code that triggers the crash:

appContext = Spring.Context.Support.ContextRegistry.GetContext();

The stack trace on Application_Start:

{"Error creating context 'spring.root': Request is not available in this context (C:\\webapp\\web.config line 287)"}{System.Configuration.ConfigurationErrorsException}

{"Request is not available in this context"}

   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) in c:\_prj\spring-net\src\Spring\Spring.Core\Util\ConfigurationUtils.cs:line 68
   at Spring.Context.Support.ContextRegistry.InitializeContextIfNeeded() in c:\_prj\spring-net\src\Spring\Spring.Core\Context\Support\ContextRegistry.cs:line 388
   at Spring.Context.Support.ContextRegistry.GetContext() in c:\_prj\spring-net\src\Spring\Spring.Core\Context\Support\ContextRegistry.cs:line 252
   at WebApp.Global.LoadSpringContainer() in C:\WebApp\Global.asax.cs:line 107
   at WebApp.Global.Application_Start(Object sender, EventArgs e) in C:\WebApp\Global.asax.cs:line 41

   at Spring.Util.VirtualEnvironment.HttpRuntimeEnvironment.RewriteContext..ctor(String virtualDirectory, Boolean rebaseClientPath) in c:\_prj\spring-net\src\Spring\Spring.Web\Util\VirtualEnvironment.cs:line 254
   at Spring.Util.VirtualEnvironment.HttpRuntimeEnvironment.RewritePath(String virtualDirectory, Boolean rebaseClientPath) in c:\_prj\spring-net\src\Spring\Spring.Web\Util\VirtualEnvironment.cs:line 341
   at Spring.Util.VirtualEnvironment.RewritePath(String newVirtualPath, Boolean rebaseClientPath) in c:\_prj\spring-net\src\Spring\Spring.Web\Util\VirtualEnvironment.cs:line 467
   at Spring.Util.HttpContextSwitch..ctor(String virtualDirectory) in c:\_prj\spring-net\src\Spring\Spring.Web\Util\HttpContextSwitch.cs:line 87
   at Spring.Context.Support.WebContextHandler.InstantiateContext(IApplicationContext parent, Object configContext, String contextName, Type contextType, Boolean caseSensitive, IList`1 resources) in c:\_prj\spring-net\src\Spring\Spring.Web\Context\Support\WebContextHandler.cs:line 121
   at Spring.Context.Support.ContextHandler.Create(Object parent, Object configContext, XmlNode section) in c:\_prj\spring-net\src\Spring\Spring.Core\Context\Support\ContextHandler.cs:line 288


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing ConfigurationUtils.cs line 68 and ContextRegistry.cs lines 252 and 388, then inspect WebContextHandler.cs line 121 and HttpContextSwitch.cs line 87. Reproduce Application_Start with the supplied Web.config under IIS Integrated Pipeline Mode and determine whether the failure is supported behavior or a library defect. Done means the compatibility result and any required configuration or fix are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.