Autofac with Azure Mobile Services (ZUMO) InvalidOperationException

31 views
Skip to first unread message

georgep...@hotmail.com

unread,
Mar 19, 2015, 1:27:11 PM3/19/15
to aut...@googlegroups.com
My WebApiConfig looks like this:

Public Module WebApiConfig
Public Sub Register()
Dim options As ConfigOptions = New ConfigOptions()

Dim config As HttpConfiguration = ServiceConfig.Initialize(New ConfigBuilder(options, Function(configuration, builder)
builder.RegisterType(Of BarMOSDbContext).As(Of IDbContext)() builder.RegisterGeneric(GetType(Repository(Of ))).[As](GetType(IRepository(Of )))
builder.RegisterType(Of DeviceDomainManager).As(Of IDeviceDomainManager)()
Return True
End Function))

End Sub

End Module

Locally everything is ok but when I publish to Azure I get an Invalid operation exception

Error Exception=System.InvalidOperationException: An error occurred when trying to create a controller of type 'DeviceController'. Make sure that the controller has a parameterless public constructor. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'BarMOS.Service.DeviceController' can be invoked with the available services and parameters:
Cannot resolve parameter 'BarMOS.Service.DomainManagers.Abstract.IDeviceDomainManager deviceManager' of constructor 'Void .ctor(BarMOS.Service.DomainManagers.Abstract.IDeviceDomainManager)'.
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at

Why locally everything is OK and when I upload I get this error? Can anyone help me?

Thank you for your time.

Travis Illig

unread,
Mar 20, 2015, 12:47:51 PM3/20/15
to aut...@googlegroups.com, georgep...@hotmail.com
We probably need a bit more info to help you out.
  • Can you show us the rest of the dependency registrations?
  • Can you show us the constructors for DeviceController, DeviceDomainManager, and any of the chained custom dependencies required to construct those things?
  • Is there anything else that might help - like...
    • What's in the "ServiceConfig.Initialize" method?
    • Has this worked before and just now stopped or has it always failed to work?
    • Are you doing some sort of assembly scanning that might fail on Azure?
    • Anything crazy going on in web.config like custom probing paths or anything else?
Thanks,
-T
Reply all
Reply to author
Forward
0 new messages