Media folder location configurable

Topics: Customizing Orchard
Sep 21, 2011 at 1:37 PM

Hello all,

We are interested in making the root/media folder configurable. This way it can sit on a UNC path or wherever, and the rest of website code can sit on multiple webservers.

 

It seems that there is no way to configure its location right now. Could you give me some pointers as to where I should hack around to make this possible?

 

Thank you

Coordinator
Sep 21, 2011 at 3:33 PM

There is a module for that, Media Folder, on the gallery. It allows it exactly. IT has been done to allow te IIS Web Farm Framework to be used with Orchard.

Sep 21, 2011 at 7:07 PM

Heloo sebastianeros,

Thank you for the suggestion. Unfortunatelly, this module is not compatible with v1.2 of orchard. Installing it gives an exception that breaks the whole site.

Is there any other workaround? 

Developer
Sep 21, 2011 at 8:08 PM

Do you have the exception?

Coordinator
Sep 21, 2011 at 8:30 PM

I just tried it locally and it's working fine. On 1.2.

Sep 22, 2011 at 7:13 AM

Hello all, thank you for your continuous support. This is the exception. I have also posted it on the project site.

 

[NullReferenceException: Object reference not set to an instance of an object.]
   Contrib.MediaFolder.Services.RemoteStorageProvider.InitializePaths() +29
   Contrib.MediaFolder.Services.RemoteStorageProvider.ListFolders(String path) +160
   Orchard.Media.Services.MediaService.GetMediaFolders(String relativePath) +25
   Mello.ImageGallery.Services.ImageGalleryService..ctor(IMediaService mediaService, IRepository`1 repository, IRepository`1 imageRepository, IThumbnailService thumbnailService, IRepository`1 imageGalleryPartRepository, IOrchardServices services, IStorageProvider storageProvider) +550

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType) +0
   System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +527
   System.Reflection.ConstructorInfo.Invoke(Object[] parameters) +35
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +321
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +122
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +255
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +92
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +321
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +122
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +255
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +110
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +488
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +104
   Autofac.Features.Collections.<>c__DisplayClass4.b__0(IComponentContext c, IEnumerable`1 p) +197
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +74
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +141
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246
   Autofac.Builder.<>c__DisplayClass1`1.b__0(IComponentContext c, IEnumerable`1 p) +15
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +74
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +141
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +92
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +321
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +122
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +255
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +110
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +488
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +104
   Autofac.Features.Collections.<>c__DisplayClass4.b__0(IComponentContext c, IEnumerable`1 p) +197
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +74
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +141
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246
   Autofac.Builder.<>c__DisplayClass1`1.b__0(IComponentContext c, IEnumerable`1 p) +15
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +74
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +141
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246
   Autofac.Core.Lifetime.LifetimeScope.Resolve(IComponentRegistration registration, IEnumerable`1 parameters) +276
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, Service service, IEnumerable`1 parameters) +221
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +117
   Orchard.ContentManagement.DefaultContentManager.New(String contentType) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\DefaultContentManager.cs:77
   Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\DefaultContentManager.cs:139
   System.Linq.WhereSelectListIterator`2.MoveNext() +232
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +472
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +80
   Orchard.ContentManagement.ContentQuery`1.Orchard.ContentManagement.IContentQuery.List() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\DefaultContentQuery.cs:184
   Orchard.Blogs.Services.BlogService.Get(VersionOptions versionOptions) +367
   Orchard.Blogs.Routing.BlogPathConstraintUpdator.Refresh() +31

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +152
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +396
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
   Orchard.Events.DefaultOrchardEventBus.TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:86
   Orchard.Events.DefaultOrchardEventBus.TryInvoke(IEventHandler eventHandler, String interfaceName, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:76
   Orchard.Events.DefaultOrchardEventBus.TryNotifyHandler(IEventHandler eventHandler, String messageName, String interfaceName, String methodName, IDictionary`2 eventData, Boolean failFast, IEnumerable& returnValue) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:62
   Orchard.Events.d__0.MoveNext() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:39
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +488
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +104
   Orchard.Events.DefaultOrchardEventBus.Notify(String messageName, IDictionary`2 eventData) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:25
   Orchard.Events.EventsInterceptor.Intercept(IInvocation invocation) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\EventsInterceptor.cs:24
   Orchard.Environment.DefaultOrchardShell.Activate() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardShell.cs:40
   Orchard.Environment.DefaultOrchardHost.b__4(ShellSettings settings) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:112
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +110
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +488
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +104
   Orchard.Environment.DefaultOrchardHost.BuildCurrent() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:97
   Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.Initialize() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:64
   Orchard.Web.MvcApplication.HostInitialization(HttpApplication application) in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Web\Global.asax.cs:51
   Orchard.WarmupStarter.<>c__DisplayClass3.b__2(Object state) in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Startup\Starter.cs:89

[ApplicationException: Error during application initialization]
   Orchard.WarmupStarter.Starter`1.OnBeginRequest(HttpApplication application) in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Startup\Starter.cs:63

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +152
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +396
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35
   System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +74
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270