Writing a module for Orchard.Azure v. 1.7

Topics: Core, Customizing Orchard, Installing Orchard, Troubleshooting, Writing modules
Oct 15, 2013 at 12:35 PM
Hello,

First of all I want to specify that the requirement is to use Orchard 1.7 and deploy it, with a custom module, as a Windows Azure web role.

What I did so far:
  1. Downloaded Orchard 1.7 source
  2. Opened the Orchard.Azure solution and configured the storage settings to an existing Azure storage account
  3. Ran the Orchard.Azure cloud service locally, and submitted the default recipe to an existing Azure database.
  4. Opened the orchard cmd and executed a command line for creating a new module. I get this error:
    codegen module ShowManager

Error executing command "codegen module ShowManager"

SetConfigurationSettingPublisher needs to be called before FromConfigurationSett
ing can be used

Exception Details: System.InvalidOperationException: SetConfigurationSettingPubl
isher needs to be called before FromConfigurationSetting can be used

Stack Trace:

[InvalidOperationException: SetConfigurationSettingPublisher needs to be called
before FromConfigurationSetting can be used]
at Microsoft.WindowsAzure.CloudStorageAccount.FromConfigurationSetting(String
settingName)
at Orchard.Azure.FileSystems.Media.AzureBlobStorageProvider..ctor(ShellSettin
gs shellSettings) in d:\Learnings\Orchard.Source.1.7\src\Orchard.Azure\FileSyste
ms\Media\AzureBlobStorageProvider.cs:line 9
at lambda_method(Closure , Object[] )
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate
() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\Con
structorParameterBinding.cs:line 128

[DependencyResolutionException: An exception was thrown while invoking the const
ructor 'Void .ctor(Orchard.Environment.Configuration.ShellSettings)' on type 'Az
ureBlobStorageProvider'. ---> SetConfigurationSettingPublisher needs to be calle
d before FromConfigurationSetting can be used (See inner exception for details.)
]
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate
() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\Con
structorParameterBinding.cs:line 137
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IC
omponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Co
re\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters) i
n c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:l
ine 79
at Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() in c:\Projects\OSS\a
utofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 cr
eator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScop
e.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(ISharingLifeti
meScope currentOperationScope, IComponentRegistration registration, IEnumerable

1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\Reso
lveOperation.cs:line 123
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistrat
ion registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Sour
ce\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\Activ
ators\Reflection\AutowiringParameter.cs:line 62
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate
() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\Con
structorParameterBinding.cs:line 114
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IC
omponentContext context, IEnumerable
1 parameters) in c:\Projects\OSS\autofac\Co
re\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) i
n c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:l


I previously used the same approach to the non Azure solution, and it worked.

Does anyone has any pointers on how to approach this issue?

Thanks.
Florin
Oct 24, 2013 at 11:34 AM
We have just started seeing this message on our Azure environments too.

We're still currently on 1.6, and this site has been in production for a few months now without this happening.

We're not sure what we've changed but we need a fix for it. If anyone can shed some light that would be appreciated.