Closed GoogleCodeExporter closed 8 years ago
Hi Abe, have you tried putting a breakpoint in your Dispose() method on a
controller?
Autofac does dispose controllers - it just isn't necessary to do this
explicitly via the controller factory.
If you're having problems with disposal in MVC2, please add the HTTP module to
web.config as described on the MVC2 integration wiki page.
If you're having problems with MVC3, please follow up as this might indicate a
bug.
Hope this helps!
Nick
Original comment by nicholas...@gmail.com
on 4 Feb 2011 at 11:29
Yes, logging and breakpoints; never a Dispose() called. It's the reason I
found the empty implementation. I'm running MVC2 and, yes, have added the http
module as per the wiki. This is copy and pasted directly from my Web.config:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<add name="ContainerDisposal" type="Autofac.Integration.Web.ContainerDisposalModule, Autofac.Integration.Web" preCondition="managedHandler"/>
</modules>
</system.webServer>
Original comment by abe.gill...@gmail.com
on 4 Feb 2011 at 11:34
Thanks Abe. That't the config for IIS7 - is it possible your dev/test
environment needs the IIS6 version?
Also just to brainstorm (not sure if Controller is disposable in MVC2 or not) -
are you adding an implementation of IDisposable to the controller, or are you
overriding the Dispose(bool) version?
If it is possible to repro this in a blank MVC2 project it would be extremely
helpful if you could attach one.
Thanks!
Nick
Original comment by nicholas...@gmail.com
on 5 Feb 2011 at 10:05
OK, well after putting together a test case project, I found out that I
apparently need to configure with the IIS6 version. Which is odd, because I'm
testing with VS.Net's debug ASP.Net server. The template Web.config has a
<system.webServer><modules> section and does NOT have a
<system.web><httpModules>. You'd think the combo of running the latest dev
environment and that very environment's Web.config template suggesting an IIS7
setup would actually mean use an IIS7 config. I guess the ASP.Net dev server
is out of band from IIS proper.
In any case, my production environment was suffering the same issue. But it's
a Mono / Apache setup so it might also require the legacy config.
Sorry for the noise ... of course maybe this situation should be noted in the
wiki.
Thanks.
-Abe
Original comment by abe.gill...@gmail.com
on 6 Feb 2011 at 8:11
Hi Abe,
Many thanks for following up - glad we tracked it down. I agree it is
completely unexpected when running under VS.
Intrigued to hear more about your experiences using Autofac with Mono/Apache...
if you ever have a chance to post some notes to the discussion group I'm sure
others would be interested too.
Cheers,
Nick
Original comment by nicholas...@gmail.com
on 6 Feb 2011 at 8:15
No worries, thanks for looking into it so rapidly. My comments about Autofac
on Mono? ... nearly none except that it works completely as advertised (insofar
as my use goes).
Original comment by abe.gill...@gmail.com
on 6 Feb 2011 at 8:21
Original issue reported on code.google.com by
abe.gill...@gmail.com
on 4 Feb 2011 at 8:01