Kentico Library media file not available in MVC website

501 Views Asked by At

I'm creating a Kentico media library file using Kentico API 11.0.26. The CMS and MVC app are on a web farm. Both are in healthy state.

The file gets created fine, but is only accessible on the CMS application, not on the MVC website. This is true for both Direct Path link as well we Permanent link.

Copying/pasting the Permanent link in browser preceded with MVC domain gives this message: "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

Can someone explain what "same UNC root defined " means in this section:

If you are running the system on a web farm and have the same UNC root defined on all servers, it is necessary to add the following key into your web.config file. The files stored in the libraries are then not transferred when synchronizing the web farm content:

<add key="CMSWebFarmSynchronizeMediaFiles" value="false"/>

https://docs.kentico.com/k12/configuring-kentico/configuring-the-environment-for-content-editors/configuring-media-libraries

1

There are 1 best solutions below

2
Dat Nguyen On

The UNC (Universal naming convention) is the standard for identifying a server/machine on a network, used like so: \\server-name\rest of path

In Kentico, you would be using UNC to tell Kentico where you're storing media library files if it's on a different server in the network.

The first thing that came to mind why you're getting a 404 is it's probably that the media URL has a tilde (~) preceding it. If that's the case, remove that tilde and see if the problem is resolved. Personally, I do a replace like so:

MediaLibraryHelper.GetPermanentUrl(mediaLibraryFile).Replace("~/", "/")

I'm not aware if there's a helper function to give you a URL without string replacing the tilde.