We have replication set up on a VARBINARY(MAX) column that stores image data (yes, yes, I know - don't blame me, I didn't design it). Recently, we started inserting larger images (around 200kb) and every time it breaks the replication with the following message:
The distribution agent failed to create temporary files in 'C:\Program Files\Microsoft SQL Server\110\COM' directory. System returned errorcode 5. (Source: MSSQL_REPL, Error number: MSSQL_REPL21100)
If I re-initialise the subscription with a new snapshot, everything syncs up fine (including the VARBINARY) and the error goes away. If I then update the VARBINARY column the replication breaks again and we go back to step 1.
The first thing I checked was that the accounts that run the 'SQL Server' and 'SQL Server Agent' services both have full access to the directory - they did.
Next I made sure the server was configured to replicate large VARBINARYs:
-- Set the maximum replication size to unlimited.
EXEC sp_configure 'max text repl size', -1;
GO
RECONFIGURE;
GO
This didn't help (I think it was already set to unlimited). What is going on here and how do I fix it?