We're using a custom PublicationResolver to serve content from multiple publications out of a single IIS web application and this setup is working fine for pages.
When I request a binary through the BinaryDistributionModule it always uses the configured DD4T.PublicationId appsetting (through the builtin DefaultPublicationResolver presumably) it doesn't use the custom resolver though.
My DD4T log shows the module is picking up the request:
2014-12-11 13:33:32,706 [18] INFO DD4T.LogWrappers.Log4Net.Log4NetLogger - >>DistributionModule_OnBeginRequest (/cdn/hofint.com/HoF%20Discovery%20Days%20-%20Day%201_tcm11-1663.pptx)
2014-12-11 13:33:32,706 [18] INFO DD4T.LogWrappers.Log4Net.Log4NetLogger - <<DistributionModule_OnBeginRequest (/cdn/hofint.com/HoF%20Discovery%20Days%20-%20Day%201_tcm11-1663.pptx)
2014-12-11 13:33:32,710 [18] DEBUG DD4T.LogWrappers.Log4Net.Log4NetLogger - Start processing /cdn/hofint.com/HoF%20Discovery%20Days%20-%20Day%201_tcm11-1663.pptx
The cd_core log shows the BinaryMetaFactory looking for the binary in the wrong publication (configured as 9999 as we never use this value so if we see it we know something is wrong):
2014-12-11 13:33:32,711 DEBUG BinaryMetaFactory - Finding binary by url 9999,/cdn/hofint.com/HoF%20Discovery%20Days%20-%20Day%201_tcm11-1663.pptx
As we are using AutoFac as a IoC container i've tried to get various parts of DD4T to use the correct IPublicationResolver:
builder.RegisterType<ComponentFactory>()
.As<IComponentFactory>()
.WithProperty("PublicationResolver", new DynamicPublicationResolver())
.SingleInstance();
builder.RegisterType<PageFactory>()
.As<IPageFactory>()
.WithProperty("PublicationResolver", new DynamicPublicationResolver());
builder.RegisterType<BinaryFactory>()
.As<IBinaryFactory>()
.WithProperty("PublicationResolver", new DynamicPublicationResolver())
.SingleInstance();
builder.RegisterType<LinkFactory>()
.As<ILinkFactory>()
.WithProperty("PublicationResolver", new DynamicPublicationResolver())
.SingleInstance();
builder.RegisterType<DynamicPublicationResolver>()
.As<IPublicationResolver>()
.SingleInstance();
Unfortunately none of the above seems to do the trick for the BinaryDistributionModule and I haven't found any information on how to configure this elsewhere.
Note that I have (of course) tested if the whole setup works at all by temporarily switching the DD4T.PublicationId setting to the "correct" publication...
Lastly my question: how to inform the BinaryDistributionModule to use the custom publication resolver?