Closed joeldow closed 9 years ago
I found the issue for me was we were using a different IoC container (funq).
We fixed the issue by including the assemblies Change
new ServiceStack.Mvc.FunqControllerFactory(container);
To
new FunqControllerFactory(container, typeof(ElmahLogger).GetAssembly(), typeof(ElmahController).GetAssembly())
DI issue, not an ELMAH.MVC issue.
@sl33kr Does this mean that I can't use this package with servicestack and keep the servicestack Mvc-integration I have that auto-wires shared dependencies?
@darrenshrwd No it should still work. In our case because we weren't using Funq as our controller we had to use the FunqControllerFactory to instruct Funq/ServiceStack to lookup dependencies from our container. That constructor I gave the example for the first parameter is your container, next set is a param array of assemblies that ServiceStack should scan to look for MVC controllers.
Thanks, I can't find 'ElmahLogger' any more, but the following worked:
// Set MVC to use the same Funq IOC as ServiceStack, include the Elmah.Mvc assembly
ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container, typeof(Elmah.Mvc.ElmahController).GetAssembly()));
HOWEVER I then tried setting the config key "elmah.mvc.requiresAuthentication" value to "true" I could no longer login to my site (uses ServiceStack authentication)...I expect to use the servicestack authentication I will need the ElmahController to inherit from ServiceStackController as then the IsAuthenticated will work. I guess I will get the source for this repo and go from there, thanks.
Elmah was working in my project but suddenly started giving me this message. I cannot get elmah working properly. What should I do? Elmah still stores data in the db, but doesn't give me a UI.
http://stackoverflow.com/questions/21152657/required-dependency-of-type-elmah-mvc-elmahcontroller-could-not-be-resolved
<error application="/LM/W3SVC/4/ROOT" host="JDOW-WIN7VM" type="Funq.ResolutionException" message="Required dependency of type Elmah.Mvc.ElmahController could not be resolved." source="ServiceStack" detail="Funq.ResolutionException: Required dependency of type Elmah.Mvc.ElmahController could not be resolved. at Funq.Container.GetEntry[TService,TFunc](String serviceName, Boolean throwIfMissing) at Funq.Container.ResolveImpl[TService](String name, Boolean throwIfMissing) at lambda_method(Closure , Container ) at ServiceStack.ServiceHost.ContainerResolveCache.CreateInstance(Type type, Boolean tryResolve) at ServiceStack.Mvc.FunqControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)" user="[user]" time="2014-01-22T23:11:35.5732170Z">