Does BinaryFactory work for binaries on the file system?

I am trying to read the binary data of a published binary using the following code:

Tridion.ContentDelivery.DynamicContent.BinaryFactory factory = new BinaryFactory();
BinaryData binaryData = factory.GetBinary(uri.ToString());

      

This worked fine until I deployed it to an environment where binaries are stored on the file system and not in the broker's database. Now BinaryData is always null, even though I'm pretty sure the file exists.

Is it mandatory to store your binaries in the database if you want to use BinaryFactory like this? Or am I missing something?

+3


source to share


1 answer


I just ran some benchmarks in my SDL Tridion 2011 SP1 HR1 environment and can confirm that it gets populated BinaryData

(i.e. not null and contains values) when my binaries are on the filesystem. I used your sample code and just added a valid binary URI which is used in my website page. I'm not sure what is different from our environment, my only thought is to check what is BinaryMeta

deployed to your broker database (although if it matters, I think it is a bug).

The ItemTypes node of my cd_storage.xml

node looks like this:

<ItemTypes defaultStorageId="defaultdb" cached="true">
    <Item typeMapping="Binary" storageId="defaultFile" cached="true"/>
</ItemTypes>

      



So, everything except the binaries is in the DB.

I'm not sure which version of Tridion SDL you are using (and I have no idea if that will affect that), but I recently heard that storing any metadata on the filesystem is no longer supported since 2011 SP1.

+4


source







All Articles