FileSystemCache SaveToFile Error

Kenny Deblaere asked on October 26, 2017 08:58

Hello

I See in my event log sometimes following error, mostly after a App_Start event:

Message: Access to the path '170720141.cache' is denied. (intentionally left out full path)

Exception type: System.UnauthorizedAccessException Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at CMS.FileSystemStorage.File.Open(String path, FileMode mode, FileAccess access) at CMS.Helpers.CacheHelper.SaveToPersistentFileInternal[DataType](PersistentCacheItem`1 item, Boolean useFullKey)

Someone who can help me fix this error? Storage shouldn't be a problem.

Kind regards

Kenny

Recent Answers


David te Kloese answered on October 26, 2017 10:01

Is it always the same cache item? Could you check if that one item is on your disk with read-only property checked?

0 votesVote for this answer Mark as a Correct answer

Kenny Deblaere answered on October 26, 2017 10:24

Hi David

It's always a different file, but the path remains the same.

I'm running an Azure Web App, and I can see the application has been recycled and was placed on another machine, but there isn't a read-only permission on the folder, and there are multiple folders where I have the same exception.

I give two screenshots, with the different logs.

FileSystem StartApp

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on October 26, 2017 10:33

Seems the file is missing on that new instance, have you checked the Microsoft Azure - best practices on Devnet to make sure you have everything configured correctly?

https://docs.kentico.com/k10/running-kentico-on-microsoft-azure/developing-for-microsoft-azure-best-practices#DevelopingforMicrosoftAzure-bestpractices-Temporaryandcachedfiles

0 votesVote for this answer Mark as a Correct answer

Kenny Deblaere answered on October 26, 2017 10:38

I've checked this document multiple times, to make sure I didn't make a mistake.

When I search the file in the folder, it's there, but I can't say if it's correct or not.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on October 26, 2017 10:44

Have you made sure the file syncing for muliple Web Farms is off?

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

0 votesVote for this answer Mark as a Correct answer

Kenny Deblaere answered on October 26, 2017 10:58

I've set the Web farm mode to Disabled. Do I have to add the web.config key? Image Text

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on October 26, 2017 11:01

Well...

https://docs.kentico.com/k10/running-kentico-on-microsoft-azure/running-kentico-in-azure-web-apps/enabling-web-farms-on-azure-web-apps

For this functionality to work with Kentico, you need to enable and configure Web farms.

But if you just use 1 instance, I'm not sure if this will tackle the changing server after recycled issue.

0 votesVote for this answer Mark as a Correct answer

Kenny Deblaere answered on October 26, 2017 11:03

I'm using just one instance, but I'll give it a try. Thanks for your help

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 26, 2017 17:20

How did you install the site? Did you deploy it from the Azure Marketplace? If so, this can cause problems as it automatically enables some items which is not desirable. If you did use the Marketplace to deploy the site, add this app settings key to Azure or your web.config and it will disable those web farm specific items that are enabled by default if installed from the Marketplace.

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

0 votesVote for this answer Mark as a Correct answer

Kenny Deblaere answered on October 27, 2017 10:05

I did not deploy it from the Azure Market place, but I've installed it locally first and deployed it to an Azure Web App.

I will add the key and check if it still works.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.