views:

314

answers:

1

My custom error messages quit working somewhere along the way and I'm getting this error. Any ideas?

Autofac.ComponentNotRegisteredException: The requested service 'controller.error.aspx' has not been registered.

I have never done anything to register them before.

I saw several questions about the custom error messages, but I couldn't find anything else wrong that was mentioned in those responses.

EDIT: I have tried "On" and "RemoteOnly" in web.config. I have an Error.aspx in the Shared folder. I am using the [ErrorHandler] attribute. This worked for a long time, and probably quit working when I made some changes to the Autofac configuration in Global.asax. The error message about the service not being registered started at the same time the errors quit working. I don't know how to register this with Autofac.

A: 

Thanks to Nicholas Blumhardt for his help on the Autofac forum and Ben Hall for his blog post. I had to add some attributes to the page tag in web.config and an mvc tag in the controls section. I don't know why the behavior of the app changed, because this information was never in web.config. But it worked!

<pages
  pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
  pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
  userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  <controls>
    <add tagPrefix="mvc" namespace="System.Web.Mvc" assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </controls>
</pages>

EDIT: Thinking about this more, I think the error page must have stopped working when I copied the MVC DLLs into my project. I had to do a DLL deployment of MVC with this app because I can't install MVC on the server.

Leslie