-
Find Source:ContextHandler.cs
Hello,
I am new to Spring.Net, so I hope this is not a total newb question.
I am writing my first spring application. When I try to run it I get a dialog box asking for me to tell it where ContextHandler.cs is. It seems to think it should be in: l:\projects\spring-net\trunk\src\Spring\Spring.Core\Context\Support\C ontextHandler.cs. I am not sure where it gets this path from. When I point it to the actual location I get an "Error creating context 'spring.root'" error.
Any ideas?
Thanks,
Sammer
-
Hi,
that is just Visual Studio catching a Spring.NET initialization error and trying to guide you to the source of the error. The funny path it suggests is caused by the build machine and its directory structure.
You shouldn't mind about that and just concentrate on the error message and trying to fix it 
-Marko
-
Thanks for the response.
Here is the actual issue. This is a web application. I have this in my web.config:
....
<sectionGroup name="spring">
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler , Spring.Core"/>
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
</sectionGroup>
....
And this in my web page code behind button click method:
protected void doSubmit(object sender, EventArgs e)
{
using (IApplicationContext ctx = ContextRegistry.GetContext())
{
....
It works fine the first time thru, but trying it again throws this:
No context registered. Use the 'RegisterContext' method or the 'spring/context' section from your configuration file.
Sammer
-
One more detail, once I have encountered the error I have to shut down and restart Visual Studio for it to clear.
-
You should access default application context with using construct as it disposes it after the block finishes. Are are returned always the same instance and you effectively delete it with using clause.
-Marko
-
Perfect, thanks very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules