3

Resolved

Orchard.Azure.Web project throws exception on out-of-box deployment

description

This is on the latest release Orchard 1.6.1 source (or tip from 1.x Orchard repository branch).

Steps to reproduce:
  1. Downloaded the source version of Orchard 1.6.1
  2. Open \src\Orchard.Azure\Orchard.Azure.sln solution in VS2012
  3. In solution explorer Orchard.Azure.CloudService => Roles => double click Orchard.Azure.Web
  4. In settings (left side tab) change the DataConnectionString and Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString connection strings from development to an actual blob storage (required for any deployment to real azure, real azure doesn't run blob emulator on port 10000)
  5. Right click Orchard.Azure.CloudService => Publish to Azure
Now when you try accessing the published site, you get the exception shown below. This exception does not occur when running inside the Emulator (but it's really slow, different issue posted) - only when deployed to Azure itself.

FYI (since it runs locally in Azure Emulator)
Test system
SW: Win8, VS2012 Ultimate, .NET 4.5, Azure SDK 2.0, 1.8 and 1.7
HW: core i7 @ 2.8Ghz, 16GB ram, SSDs, dedicated Azure emulator host
None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], System.Collections.Generic.IEnumerable`1[Orchard.WebApi.Routes.IHttpRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Autofac.Core.DependencyResolutionException: None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], System.Collections.Generic.IEnumerable`1[Orchard.WebApi.Routes.IHttpRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[DependencyResolutionException: None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], System.Collections.Generic.IEnumerable`1[Orchard.WebApi.Routes.IHttpRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.]
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +463
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +122
   Autofac.Core.Resolving.InstanceLookup.Execute() +164
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +206
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +15
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +30
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Resolving.InstanceLookup.Execute() +181
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +206
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +193
   Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +193
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +168
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +117
   Orchard.Environment.ShellBuilders.ShellContextFactory.CreateSetupContext(ShellSettings settings) +511
   Orchard.Environment.DefaultOrchardHost.CreateAndActivateShells() +370
   Orchard.Environment.DefaultOrchardHost.BuildCurrent() +195
   Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.Initialize() +105

[HttpException (0x80004005): None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], System.Collections.Generic.IEnumerable`1[Orchard.WebApi.Routes.IHttpRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4057733
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], System.Collections.Generic.IEnumerable`1[Orchard.WebApi.Routes.IHttpRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11702064
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4870277

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.276

comments

Sid_S wrote Jun 26, 2013 at 12:21 AM

Update: Similar issue seen with latest (2013-06-25 tip) from 1.x branch from the repository. The actual exception is different, provided below:
Server Error in '/' Application.

The remote server returned an error: (409) Conflict.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.WebException: The remote server returned an error: (409) Conflict.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[WebException: The remote server returned an error: (409) Conflict.]
   System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +3236585
   Microsoft.WindowsAzure.StorageClient.EventHelper.ProcessWebResponse(WebRequest req, IAsyncResult asyncResult, EventHandler`1 handler, Object sender) +80

[StorageClientException: The specified container is being deleted. Try operation later.]
   Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result() +95
   Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait() +201
   Microsoft.WindowsAzure.StorageClient.CloudBlobContainer.CreateIfNotExist(BlobRequestOptions options) +213
   Orchard.Azure.AzureFileSystem..ctor(String containerName, String root, Boolean isPrivate, CloudStorageAccount storageAccount) +418
   Orchard.Azure.Environment.Configuration.AzureShellSettingsManager..ctor(CloudStorageAccount storageAccount, IShellSettingsManagerEventHandler events) +91
   lambda_method(Closure , Object[] ) +92
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +299

[DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Orchard.Environment.Configuration.IShellSettingsManagerEventHandler)' on type 'AzureShellSettingsManager'.]
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +714
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +265
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +122
   Autofac.Core.Resolving.InstanceLookup.Execute() +164
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +206
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +157
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +265
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +122
   Autofac.Core.Resolving.InstanceLookup.Execute() +164
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +206
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +193
   Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +193
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +168
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +117
   Orchard.Azure.Web.MvcApplication.Application_Start() +322

[HttpException (0x80004005): An exception was thrown while invoking the constructor 'Void .ctor(Orchard.Environment.Configuration.IShellSettingsManagerEventHandler)' on type 'AzureShellSettingsManager'.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4057733
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): An exception was thrown while invoking the constructor 'Void .ctor(Orchard.Environment.Configuration.IShellSettingsManagerEventHandler)' on type 'AzureShellSettingsManager'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11702064
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4870277

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.276

Sid_S wrote Jun 26, 2013 at 12:32 AM

Sorry, I can't edit my own comments, just the original ticket but I noticed another observation. The The remote server returned an error: (409) Conflict. exception which I attributed to 1.x was with 1 Azure webrole instance. Then I bumped the instance count to two and since then I'm getting the None of the constructors found with 'Public binding flags' exception on both 1.6.1 and 1.x. Interestingly, dropping the instance count back to 1 doesn't revert the exception.

Hope this helps

sebastienros wrote Jul 10, 2013 at 5:36 PM

Fixed in changeset dc9023fce3cf

sfmskywalker wrote Mar 28 at 12:28 AM

Fixed in changeset 71657f4d65b472c07c688704926827cb623767e0