Orchard CMS - Sudden 404 during development - orchardcms

I was getting close to completing my first site using Orchard CMS, and when I went to enable the 'blog' module I saw an error page. I wish I had paid more attention to it, instead I closed it and restarted my site.
Now, I get 404 errors and I can access the front or back end of my site. I'm at a loss.
I found these in the error logs but I really don't know where to go from here...
2014-01-01 19:58:09,140 [11] Orchard.Environment.DefaultOrchardHost - A tenant could not be started: Default
Autofac.Core.DependencyResolutionException: None of the constructors found with 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFinderWrapper' on type 'Orchard.Blogs.Routing.ArchiveConstraint' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Autoroute.Services.IPathResolutionService pathResolutionService' of constructor 'Void .ctor(Orchard.Autoroute.Services.IPathResolutionService)'.
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 118
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79
at Autofac.Core.Resolving.InstanceLookup.b_0() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 270
at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 119
at Autofac.Core.Activators.Reflection.AutowiringParameter.<>c__DisplayClass2.<CanSupplyValue>b__0() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\AutowiringParameter.cs:line 62
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ConstructorParameterBinding.cs:line 114
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79
at Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 270
at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 119
at Autofac.Features.Collections.CollectionRegistrationSource.<>c_DisplayClass4.<>c_DisplayClass6.b_1(IComponentRegistration cr) in c:\Projects\OSS\autofac\Core\Source\Autofac\Features\Collections\CollectionRegistrationSource.cs:line 75
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()
at System.Linq.Buffer1..ctor(IEnumerable1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at Autofac.Features.Collections.CollectionRegistrationSource.<>c_DisplayClass4.b_0(IComponentContext c, IEnumerable1 p) in c:\Projects\OSS\autofac\Core\Source\Autofac\Features\Collections\CollectionRegistrationSource.cs:line 75
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 68
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79
at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 61
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 119
at Autofac.Core.Registration.ExternalRegistrySource.<>c__DisplayClass8.<RegistrationsFor>b__3(IComponentContext c, IEnumerable1 p) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Registration\ExternalRegistrySource.cs:line 80
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 68
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79
at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 61
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 119
at Autofac.Core.Activators.Reflection.AutowiringParameter.<>c_DisplayClass2.b_0() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\AutowiringParameter.cs:line 62
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ConstructorParameterBinding.cs:line 114
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79
at Autofac.Core.Resolving.InstanceLookup.b__0() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 270
at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 119
at Autofac.Core.Registration.ExternalRegistrySource.<>c__DisplayClass8.<RegistrationsFor>b__3(IComponentContext c, IEnumerable1 p) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Registration\ExternalRegistrySource.cs:line 80
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 68
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79
at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 61
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 85
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 232
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) in c:\Projects\OSS\autofac\Core\Source\Autofac\ResolutionExtensions.cs:line 736
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\ResolutionExtensions.cs:line 343
at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\ResolutionExtensions.cs:line 197
at Orchard.Environment.ShellBuilders.ShellContextFactory.CreateShellContext(ShellSettings settings) in d:\Builds\OrchardFull\src\Orchard\Environment\ShellBuilders\ShellContextFactory.cs:line 78
at Orchard.Environment.DefaultOrchardHost.CreateShellContext(ShellSettings settings) in d:\Builds\Or

Grant all users NTFS write permission on the Orchard.Web folder. This might help -- I had a similar error when permissions were not set.
Also, make sure that AppPool user (or Network service - if that's who owns your application pool) is dbo in the database that you are connecting to.
AppPool user name is "IIS AppPool\" -- you add this user as windows user in SQL server, and then user/role mapping give him dbo permissions for required database.

Related

Azure API Management returning "Setting 'config.db.connection' could not be found."

We have exposed some Azure Functions through Azure API Management. The functions work when called directly and the endpoints in Api Management also used to work. Now when we call the api management endpoints they return
[ConfigurationErrorsException: Setting 'config.db.connection' could not be found.]
Microsoft.Azure.ApiManagement.Infra.Configuration.SettingsProviderExtensions.GetSetting(ISettingsProvider provider, String name) in e:\Checkin package\AAPT\APIM\Infra\Infra\src\Infra\Configuration\SettingsProviderExtensions.cs:19
Microsoft.WindowsAzure.ApiManagement.Proxy.Api.Settings.get_SqlConnectionString() in D:\Checkin-Master\AAPT\APIManagement\Proxy\Api\Service\Settings.cs:43
Microsoft.Azure.ApiManagement.Gateway.IoC.Modules.c.b__0_0(IComponentContext c) in D:\Checkin-Master\AAPT\APIManagement\Proxy\Gateway.IoC\Modules\SqlConfigurationModule.cs:38
Autofac.c__DisplayClass10`1.b__f(IComponentContext c, IEnumerable`1 p) +10
Autofac.Builder.c__DisplayClass1`1.b__0(IComponentContext c, IEnumerable`1 p) +14
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
Autofac.Core.Resolving.InstanceLookup.b__0() +8
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118
Microsoft.Azure.ApiManagement.Gateway.IoC.Modules.c.b__0_4(IComponentContext c) in D:\Checkin-Master\AAPT\APIManagement\Proxy\Gateway.IoC\Modules\ConfigurationModule.cs:116
Autofac.c__DisplayClass10`1.b__f(IComponentContext c, IEnumerable`1 p) +10
Autofac.Builder.c__DisplayClass1`1.b__0(IComponentContext c, IEnumerable`1 p) +14
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
Autofac.Core.Resolving.InstanceLookup.b__0() +8
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
Autofac.Core.Activators.Reflection.c__DisplayClass2.b__0() +25
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +174
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
Autofac.Core.Resolving.InstanceLookup.b__0() +8
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +44
[DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Setting 'config.db.connection' could not be found. (See inner exception for details.)]
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +112
Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +109
Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +14
Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118
Autofac.ResolutionExtensions.Resolve(IComponentContext context) +75
Microsoft.Azure.ApiManagement.Gateway.Host.SystemWeb.GatewayStartup.Configuration(IAppBuilder app) in D:\Checkin-Master\AAPT\APIManagement\Proxy\Gateway.Host.SystemWeb\GatewayStartup.cs:75
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +160
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101
Owin.Loader.c__DisplayClass12.b__b(IAppBuilder builder) +66
Owin.Loader.c__DisplayClass1.b__0(IAppBuilder builder) +123
Microsoft.Owin.Host.SystemWeb.c__DisplayClass2.b__0(IAppBuilder builder) +71
Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +462
Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +40
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +70
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +523
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +176
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +220
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +303
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +658
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189
Where is this db.connection setting that is missing?
I guess you were using consumption sku. Apim had a bug in upgrade. This should not be happening anymore.

Net Core 2.0 Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(Type type, Object instance, IConfiguration config) is not thread safe

Platform: NetCore 2.0
Issue location: getting IOptionsSnapshot in service constructor.
Description: Under loading testing with high pressure I had an exception (very rarely): "Collection was modified; enumeration operation may not execute."
It happens in class\function Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(Type type, Object instance, IConfiguration config) line 269
if(config != null && config.GetChildren().Any())
Regarding trace log it happens in linq function Any(). Looks like ConfigurationBinder is not thread safe here.
Any thoughts how it could be fixed?
Trace logs:
[2017-12-22T09:37:38.3955213Z] Level=Error, Category=Autofac, Id=qq,
Message= Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = PlaybackService (ReflectionActivator), Services = [XXXXXXXXXXXXXXXXXXXXXXXXXX.IPlaybackService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope --->
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = IntegrationService (ReflectionActivator), Services = [XXXXXXXXXXXXXXXXXXXXXXXXXX.IIntegrationService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope --->
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = TokenRepository (ReflectionActivator), Services = [XXXXXXXXXXXXXXXXXXXXXXXXXX.ITokenRepository], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope --->
An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptionsSnapshot`1[XXXXXXXXXXXXXXXXXXXXXXXXXX.DXXXXConfig], XXXXXXXXXXXXXXXXXXXXXXXXXX.ICertificateRepository)' on type 'TokenRepository'. --->
Collection was modified; enumeration operation may not execute. (See inner exception for details.) --->
Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = IntegrationService (ReflectionActivator), Services = [XXXXXXXXXXXXXXXXXXXXXXXXXX.IIntegrationService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope --->
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = TokenRepository (ReflectionActivator), Services = [XXXXXXXXXXXXXXXXXXXXXXXXXX.ITokenRepository], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope --->
An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptionsSnapshot`1[XXXXXXXXXXXXXXXXXXXXXXXXXX.DXXXXXXConfig], XXXXXXXXXXXXXXXXXXXXXXXXXX.ICertificateRepository)' on type 'TokenRepository'. --->
Collection was modified; enumeration operation may not execute. (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) --->
Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = TokenRepository (ReflectionActivator), Services = [XXXXXXXXXXXXXXXXXXXXXXXXXX.ITokenRepository], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope --->
An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptionsSnapshot`1[XXXXXXXXXXXXXXXXXXXXXXXXXX.DXXXXConfig], XXXXXXXXXXXXXXXXXXXXXXXXXX.ICertificateRepository)' on type 'TokenRepository'. --->
Collection was modified; enumeration operation may not execute. (See inner exception for details.) (See inner exception for details.) --->
Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptionsSnapshot`1[XXXXXXXXXXXXXXXXXXXXXXXXXX.DXXXXConfig], XXXXXXXXXXXXXXXXXXXXXXXXXX.ICertificateRepository)' on type 'TokenRepository'. --->
Collection was modified; enumeration operation may not execute. (See inner exception for details.) --->
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion()
at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.SparseArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.SparseArrayBuilder`1.ReserveOrAdd(IEnumerable`1 items)
at System.Linq.Enumerable.Concat2Iterator`1.ToArray()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d_3.MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.SparseArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.SparseArrayBuilder`1.ReserveOrAdd(IEnumerable`1 items)
at System.Linq.Enumerable.Concat2Iterator`1.ToArray()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d3.MoveNext()
at System.Linq.Enumerable.DistinctIterator`1.MoveNext()
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
at Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(Type type, Object instance, IConfiguration config)
at Microsoft.Extensions.Configuration.ConfigurationBinder.BindProperty(PropertyInfo property, Object instance, IConfiguration config)
at Microsoft.Extensions.Configuration.ConfigurationBinder.BindNonScalar(IConfiguration configuration, Object instance)
at Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(Type type, Object instance, IConfiguration config)
at Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration configuration, Object instance)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at lambda_method(Closure , Object[] )
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() — End of inner exception stack trace —
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) — End of inner exception stack trace —
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) — End of inner exception stack trace —
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) — End of inner exception stack trace —
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
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.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Microsoft.Extensions.Internal.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at lambda_method(Closure , IServiceProvider , Object[] )
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>cDisplayClass5_0.<CreateControllerFactory>gCreateController|0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d_14.MoveNext() — End of stack trace from previous location where exception was thrown ---... MESSAGE Truncated=True DUE TO EXCEEDING MaxAllowedCharacterLength=10000, ActualCharacterLength=11707

request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method error in bots

We are creating the bots using Amazon.Lex API which is part of aws-sdk-net, this bots interacts with Amazon lex model. On executing this bot we are getting below mentioned error.
There are other questions exists in SO with the same issue, but those are not related to aws lex sdk.
Amazon.Runtime.AmazonUnmarshallingException was unhandled
HResult=-2146233088
Message=Error unmarshalling response back from AWS. Request ID: XXXXXXXXXXXXXX, Response Body: <InvalidSignatureException>
<Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
The Canonical String for this request should have been
'POST
/bot/OrderFlowers/alias/user/text
content-type:application/x-amz-json-1.1
host:runtime.lex.us-east-1.amazonaws.com
user-agent:aws-sdk-dotnet-45/3.3.1.6 aws-sdk-dotnet-core/3.3.14.1 .NET_Runtime/4.0 .NET_Framework/4.0 OS/Microsoft_Windows_NT_6.2.9200.0 ClientSync
x-amz-content-sha256:
x-amz-date:20170605T120548Z
content-type;host;user-agent;x-amz-content-sha256;x-amz-date'
The String-to-Sign should have been
'AWS4-HMAC-SHA256
20170605T120548Z
20170605/us-east-1/lex/aws4_request'
</Message>
</InvalidSignatureException>
RequestId=
ResponseBody=<InvalidSignatureException>
<Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
The Canonical String for this request should have been
'POST
/bot/OrderFlowers/alias/user/text
content-type:application/x-amz-json-1.1
host:runtime.lex.us-east-1.amazonaws.com
user-agent:aws-sdk-dotnet-45/3.3.1.6 aws-sdk-dotnet-core/3.3.14.1 .NET_Runtime/4.0 .NET_Framework/4.0 OS/Microsoft_Windows_NT_6.2.9200.0 ClientSync
x-amz-content-sha256:
x-amz-date:20170605T120548Z
content-type;host;user-agent;x-amz-content-sha256;x-amz-date
The String-to-Sign should have been
'AWS4-HMAC-SHA256
20170605T120548Z
20170605/us-east-1/lex/aws4_request
'
</Message>
</InvalidSignatureException>
Source=AWSSDK.Core
StackTrace:
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException(IExecutionContext executionContext, HttpErrorResponseException exception) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\HttpErrorResponseExceptionHandler.cs:line 111
at Amazon.Runtime.Internal.ExceptionHandler`1.Handle(IExecutionContext executionContext, Exception exception) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\ExceptionHandler.cs:line 38
at Amazon.Runtime.Internal.ErrorHandler.ProcessException(IExecutionContext executionContext, Exception exception) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\ErrorHandler.cs:line 204
at Amazon.Runtime.Internal.ErrorHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\ErrorHandler.cs:line 78
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 45
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.Signer.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\Signer.cs:line 38
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.CredentialsRetriever.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CredentialsRetriever.cs:line 72
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.RetryHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\RetryHandler\RetryHandler.cs:line 84
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 45
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.EndpointResolver.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\EndpointResolver.cs:line 34
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.Marshaller.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\Marshaller.cs:line 37
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 45
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\ErrorCallbackHandler.cs:line 44
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\MetricsHandler.cs:line 40
at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\RuntimePipeline.cs:line 135
at Amazon.Runtime.AmazonServiceClient.Invoke[TRequest,TResponse](TRequest request, IMarshaller`2 marshaller, ResponseUnmarshaller unmarshaller) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\AmazonServiceClient.cs:line 192
at Amazon.Lex.AmazonLexClient.PostText(PostTextRequest request) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Services\Lex\Generated\_bcl45\AmazonLexClient.cs:line 508
at AWSLexClient.Program.Main(String[] args) in D:\Sameer\Practice\Bots\AWSLexClient\AWSLexClient\Program.cs:line 30
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
HResult=-2146232000
LineNumber=0
LinePosition=0
Message=Root element is missing.
Source=System.Xml
SourceUri=""
StackTrace:
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at Amazon.Runtime.Internal.Transform.XmlUnmarshallerContext.Read() in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Internal\Transform\UnmarshallerContext.cs:line 368
at Amazon.Runtime.Internal.Transform.ErrorResponseUnmarshaller.Unmarshall(XmlUnmarshallerContext context) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Internal\Transform\ErrorResponseUnmarshaller.cs:line 36
at Amazon.Runtime.Internal.Transform.JsonErrorResponseUnmarshaller.Unmarshall(JsonUnmarshallerContext context) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Internal\Transform\JsonErrorResponseUnmarshaller.cs:line 41
at Amazon.Lex.Model.Internal.MarshallTransformations.PostTextResponseUnmarshaller.UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Services\Lex\Generated\Model\Internal\MarshallTransformations\PostTextResponseUnmarshaller.cs:line 110
at Amazon.Runtime.Internal.Transform.JsonResponseUnmarshaller.UnmarshallException(UnmarshallerContext input, Exception innerException, HttpStatusCode statusCode) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Internal\Transform\ResponseUnmarshallers.cs:line 198
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException(IExecutionContext executionContext, HttpErrorResponseException exception) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\HttpErrorResponseExceptionHandler.cs:line 78
InnerException:
We implemented the following code
AWSCredentials credentials = new BasicAWSCredentials("xxxxxxxxxx", "xxxxxxxxxxxxxxxxxx");
AmazonLexClient client = new AmazonLexClient(credentials, new AmazonLexConfig {
ServiceURL = "https://runtime.lex.us-east-1.amazonaws.com",
DisableLogging = false,
#region proxy setting
ProxyCredentials = new NetworkCredential("xxxxxx","XXXXXX")
#endregion
});
var response= client.PostText(new PostTextRequest()
{
BotAlias = "",
BotName = "OrderFlowers",
InputText = "I would like to pick up flowers",
UserId = ""
});
Console.WriteLine("{0}-{1}", response.HttpStatusCode.ToString(), response.Message);
Console.ReadKey();
Note the version of the framework:
"AWSSDK.Core" version="3.3.14.1" targetFramework="net45"
"AWSSDK.Lex" version="3.3.1.6" targetFramework="net45"
We took following steps before write this code
1) Create User and Group in IAM
2) Associated the following permission to group
AmazonLexRunBotsOnly, AmazonAPIGatewayInvokeFullAccess,AmazonLexReadOnly,
AmazonLexFullAccess, AmazonLexRunBotsOnly,AdministratorAccess
3) Added the user to this group.
We need your help to resolve this issue. Also please note we have removed access keys and other confidential data.
Thanks.

Cannot choose between multiple constructors with equal length 1 on type 'System.String'

I am getting the following error when trying to resolve a type:
Cannot choose between multiple constructors with equal length 1 on type 'System.String'. Select the constructor explicitly, with the UsingConstructor() configuration method, when the component is registered.
The type has 1 constructor that takes an IRepository and an ILog so I don't really know where the System.String is coming in to the picture. I'm perplexed. Does anyone have any idea what the problem is?
Here is the stack trace:
at Autofac.Core.Activators.Reflection.MostParametersConstructorSelector.SelectConstructorBinding(ConstructorParameterBinding[] constructorBindings)
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Activators.Reflection.AutowiringParameter.<>c_DisplayClass2.b_0()
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Activators.Reflection.AutowiringParameter.<>c_DisplayClass2.b_0()
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at SomeCompany.ComponentModel.Composition.AutofacIocContainer.Resolve(Type type) in c:\SomeCompany.Core\ComponentModel\Composition\AutofacIocContainer.cs:line 17
at SomeCompany.Commands.CommandFactory.Create(String name) in c:\SomeCompany.Core\Commands\CommandFactory.cs:line 28
at SomeCompany.Web.Controllers.CommandsController.Post(String id, String request) in c:\SomeCompany.Web\Controllers\CommandsController.cs:line 49
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()
at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func1 func, CancellationToken cancellationToken)
This has nothing to do with multiple constuctors on your own code!
Autofac automatically creates objects for the constructor of your subject when you don't set them explicitly yourself.
However, when your constructor has a String parameter, it can not create a string, as String does not have a parameterless constructor! [1]
You need to set all strings on the constructor of your subject explicitly. You can also use NamedParameters and give Strings an explicit value.
Good luck!
[1] http://msdn.microsoft.com/en-us/library/system.string%28v=vs.110%29.aspx
If you have a database-definition file (.dbml), check for modifications to the code that you didn't make. In my case, the following method
public JudicialDataContext(string connectionString) : base(connectionString, mappingSource)
{
OnCreated();
}
was changed to this:
public JudicialDataContext(string connection) : base(connection, mappingSource)
{
OnCreated();
}
I have no idea why it did this, or what it is trying to accomplish by doing this, or why this change would even be necessary. But discarding the change and recompiling overcame this error.

Transaction issues with Orchard and SSL/ADFS modules

We're using Orchard 1.6 with the Secured Sockets Layer 1.2 module and the Authentication.Federated 0.2 module. On many of the requests, we get various transaction errors. Here's an example of one that keeps cropping up:
[TransactionAbortedException: The transaction has aborted.]
System.Transactions.TransactionStateAborted.CreateAbortingClone(InternalTransaction tx) +17
System.Transactions.DependentTransaction..ctor(IsolationLevel isoLevel, InternalTransaction internalTransaction, Boolean blocking) +205
System.Transactions.Transaction.DependentClone(DependentCloneOption cloneOption) +208
System.Transactions.TransactionScope.SetCurrent(Transaction newCurrent) +152
System.Transactions.TransactionScope..ctor(TransactionScopeOption scopeOption, TransactionOptions transactionOptions) +994
Orchard.Data.TransactionManager.Orchard.Data.ITransactionManager.Demand() in C:\Projects\MySite\src\Orchard\Data\TransactionManager.cs:37
Orchard.Data.SessionLocator.For(Type entityType) in C:\Projects\MySite\src\Orchard\Data\SessionLocator.cs:31
Orchard.ContentManagement.DefaultContentManager.GetManyImplementation(QueryHints hints, Action`2 predicate) in C:\Projects\MySite\src\Orchard\ContentManagement\DefaultContentManager.cs:301
Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in C:\Projects\MySite\src\Orchard\ContentManagement\DefaultContentManager.cs:140
Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in C:\Projects\MySite\src\Orchard\ContentManagement\DefaultContentManager.cs:111
Orchard.ContentManagement.DefaultContentManager.Get(Int32 id) in C:\Projects\MySite\src\Orchard\ContentManagement\DefaultContentManager.cs:107
Orchard.Security.Providers.FormsAuthenticationService.GetAuthenticatedUser() in C:\Projects\MySite\src\Orchard\Security\Providers\FormsAuthenticationService.cs:94
Orchard.Security.CurrentUserWorkContext.<Get>b__0(WorkContext ctx) in C:\Projects\MySite\src\Orchard\Security\CurrentUserWorkContext.cs:13
Orchard.Environment.<>c__DisplayClass5`1.<FindResolverForState>b__3() in C:\Projects\MySite\src\Orchard\Environment\WorkContextImplementation.cs:37
Orchard.Environment.WorkContextImplementation.GetState(String name) in C:\Projects\MySite\src\Orchard\Environment\WorkContextImplementation.cs:28
Orchard.WorkContext.get_CurrentUser() in C:\Projects\MySite\src\Orchard\WorkContext.cs:60
Orchard.Security.Authorizer.Authorize(Permission permission, IContent content, LocalizedString message) in C:\Projects\MySite\src\Orchard\Security\Authorizer.cs:72
Orchard.Security.Authorizer.Authorize(Permission permission) in C:\Projects\MySite\src\Orchard\Security\Authorizer.cs:60
Orchard.Security.SecurityFilter.OnAuthorization(AuthorizationContext filterContext) in C:\Projects\MySite\src\Orchard\Security\SecurityFilter.cs:24
System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor) +156
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +854224
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +40
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in C:\Projects\MySite\src\Orchard\Mvc\Routes\ShellRoute.cs:162
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
This question seems to indicate that this is an issue with the ambient transactions and should hopefully get resolved in 1.7. However, is there something we can do to address these issues in 1.6?
EDIT: Here's another one we keep getting:
[InvalidOperationException: The connection object can not be enlisted in transaction scope.]
System.Data.SqlServerCe.SqlCeConnection.Enlist(Transaction tx) +199
System.Data.SqlServerCe.SqlCeConnection.Open() +403
NHibernate.Connection.DriverConnectionProvider.GetConnection() +238
NHibernate.AdoNet.ConnectionManager.GetConnection() +95
NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd) +43
[ADOException: While preparing SELECT this_.Id as Id248_3_, this_.Number as Number248_3_, this_.Published as Published248_3_, this_.Latest as Latest248_3_, this_.Data as Data248_3_, this_.ContentItemRecord_id as ContentI6_248_3_, contentite1_.Id as Id247_0_, contentite1_.Data as Data247_0_, contentite1_.ContentType_id as ContentT3_247_0_, sitesettin4_.Id as Id253_1_, sitesettin4_.SiteSalt as SiteSalt253_1_, sitesettin4_.SiteName as SiteName253_1_, sitesettin4_.SuperUser as SuperUser253_1_, sitesettin4_.PageTitleSeparator as PageTitl5_253_1_, sitesettin4_.HomePage as HomePage253_1_, sitesettin4_.SiteCulture as SiteCult7_253_1_, sitesettin4_.ResourceDebugMode as Resource8_253_1_, sitesettin4_.PageSize as PageSize253_1_, sitesettin4_.SiteTimeZone as SiteTim10_253_1_, contenttyp5_.Id as Id250_2_, contenttyp5_.Name as Name250_2_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id left outer join Settings_SiteSettingsPartRecord sitesettin4_ on contentite1_.Id=sitesettin4_.Id left outer join Orchard_Framework_ContentTypeRecord contenttyp5_ on contentite1_.ContentType_id=contenttyp5_.Id WHERE contentite1_.Id = #p0 and this_.Published = #p1 ORDER BY GETDATE() OFFSET 0 ROWS FETCH NEXT #p2 ROWS ONLY an error occurred]
NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd) +390
NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) +84
NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) +600
NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +273
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +205
NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) +425
NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) +23
NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session) +60
NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) +1055
NHibernate.Impl.CriteriaImpl.List(IList results) +63
NHibernate.Impl.CriteriaImpl.List() +79
Orchard.ContentManagement.DefaultContentManager.GetManyImplementation(QueryHints hints, Action`2 predicate) in C:\Projects\MySite\src\Orchard\ContentManagement\DefaultContentManager.cs:334
Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in C:\Projects\MySite\src\Orchard\ContentManagement\DefaultContentManager.cs:140
Orchard.ContentManagement.ContentGetExtensions.Get(IContentManager manager, Int32 id, VersionOptions options, QueryHints hints) in C:\Projects\MySite\src\Orchard\ContentManagement\ContentExtensions.cs:160
Orchard.Core.Settings.Services.SiteService.GetSiteSettings() in C:\Projects\MySite\src\Orchard.Web\Core\Settings\Services\SiteService.cs:46
Orchard.Settings.CurrentSiteWorkContext.Get(String name) in C:\Projects\MySite\src\Orchard\Settings\CurrentSiteWorkContext.cs:13
Orchard.Environment.<>c__DisplayClass5`1.<FindResolverForState>b__0(IWorkContextStateProvider wcsp) in C:\Projects\MySite\src\Orchard\Environment\WorkContextImplementation.cs:32
System.Linq.WhereSelectArrayIterator`2.MoveNext() +82
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +215
Orchard.Environment.WorkContextImplementation.FindResolverForState(String name) in C:\Projects\MySite\src\Orchard\Environment\WorkContextImplementation.cs:32
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +83
Orchard.Environment.WorkContextImplementation.GetState(String name) in C:\Projects\MySite\src\Orchard\Environment\WorkContextImplementation.cs:27
Orchard.WorkContext.get_CurrentSite() in C:\Projects\MySite\src\Orchard\WorkContext.cs:52
Contrib.SecuredSocketsLayer.Filters.SecuredSocketsLayersFilter.OnActionExecuting(ActionExecutingContext filterContext) +231
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +72
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +854290
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +309
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +854224
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +40
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in C:\Projects\MySite\src\Orchard\Mvc\Routes\ShellRoute.cs:162
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
EDIT2: Took the SSL module out of the mix by disabling it and am just accessing over SSL at all times. (Doesn't solve the issue, but does show that this issue occurs with just the Auth.Fed module.)
EDIT3: I tried putting suppression code around each method in the Auth.Fed module, but it didn't help. (Causes issues on the Authenticate due to nested transactions, which made me think that might be where the issue was, but then I was able to reproduce before getting to that step, so doesn't seem to be it.)

Resources