Access to the path

Access to the path ‘GDV15B6___portaldev_data_AdvanceFlowDev_009_14_PreviewDocExport_PreviewingDocumentXmlCache_20180117-200125401_16472_png_html_fd.xml’ is denied.

Why i occusionally get this error when using the code
string storagePath =Path.GetDirectoryName(PathService.GetNetworkPath(firmId, userId, PreviewOtherExports, fileName));
_config = PreviewUtility.GetConfig(storagePath);
_htmlHandler = new ViewerHtmlHandler(_config);

  List<PageHtml> pages = _htmlHandler.GetPages(documentPath, options);
        return pages != null
            ? pages.Select(
                page => new HtmlViewInformation {HtmlContent = page.HtmlContent, PageNumber = page.PageNumber})
                .ToList()
            : new List<HtmlViewInformation>();

This happens when i have a scheduler which process the doc and
when web tried to retrived the scheduler processed document.Scheduler run under user “svcservice” and
web run under user afwebpool.Actually web try to retrieve after scheduler is done with doc.Still why the lock comes?If scheduler and web are on different machine this access error doesn’t happen

source file and cached group files are all in network path

anything we can do in this code to fix access denied error that comes occasionally ?

List pages = _htmlHandler.GetPages(documentPath, options);

Access to the path ‘GDV15B6___portaldev_data_AdvanceFlowDev_009_14_PreviewDocExport_PreviewingDocumentXmlCache_20180117-200125401_16472_png_html_fd.xml’ is denied.

@philipthomas32,

Thanks for using GroupDocs.Viewer and posting your issue here. Would you please share with us the complete details about the exception you are getting? Furthermore, the details you would have got in the stack trace would be helpful for us. We shall be looking forward to your response.

Scheduler code(its a sechuler service that create html content, scheduler run under user account svc.services)

List pages = _htmlHandler.GetPages("\portaldev\data\AdvanceFlowDev\009\14\PreviewDocExport\20180117-204313687_16216.txt", options);

Web code (read html content, web app pool runder user svc.afwebpool)

 List<PageHtml> pages = _htmlHandler.GetPages("20180117-204313687_16216.txt", options);

// above code retrive cached data from location 
//\\portaldev\data\FlowDev\009\14\PreviewDocExport\PreviewingDocumentXmlCache\20180117-204313687_16216_txt		

This work most times ,some times we get following exception like below when web code retrive cached data

This is the exception.

Access to the path ‘GDV15B6___portaldev_data_AdvanceFlowDev_009_14_PreviewDocExport_PreviewingDocumentXmlCache_20180117-200125401_16472_png_html_fd.xml’ is denied.

Our scheuler and web user account have full access to network path \portaldev\data\FlowDev

Web code is accessing data after scheuler is done with doc.Is anything we should do to make sure scheuler release everything from groupdoc?Any sample code for that?

if scheuler code and web code are on different machines we dont see this error,but if we have scheduler task scheduler and web running on same machine we see this errror occasionally

ANy help is appreciated.Please look in to my previous reply.Have you seen this access denied error and any recommendation in groupdoc call to prevent it

Here is the stack trace

2018-01-18 15:06:34,440 ERROR Access to the path ‘GDV15B6___portaldev_data_AFDev_009_14_PreviewDocExport_PreviewingDocumentXmlCache_20180118-090626674_16471_xlsm_html_fd.xml’ is denied. ((null)/(null)) [CL-AFDVAP-01, /LM/W3SVC/1/ROOT-1-131607609635694603, 17, ConvertNConsecutivePagesToHtml()]
2018-01-18 15:06:34,471 ERROR at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Threading.Mutex.MutexTryCodeHelper.MutexTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.Mutex.CreateMutexWithGuaranteedCleanup(Boolean initiallyOwned, String name, Boolean& createdNew, SECURITY_ATTRIBUTES secAttrs)
at System.Threading.Mutex…ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity)
at System.Threading.Mutex…ctor(Boolean initiallyOwned, String name, Boolean& createdNew)
at  .GetFileData(FileDescription )
at ? .(FileDataOptions )
at GroupDocs.Viewer.Handler.ViewerHandler1.(? ) at GroupDocs.Viewer.Handler.ViewerHandler1.(? )
at AF.Services.DocumentManagement.Preview.PreviewDocumentService.GetHtmlPages(String documentPath, HtmlOptions options) in C:\gj\tfs\source\AF\Dev\AF.Services\DocumentManagement\Preview\PreviewDocumentService.cs:line 514
at AF.Services.DocumentManagement.Preview.PreviewDocumentService.ConvertNConsecutivePagesToHtml(String firmId, Int32 userId, String gfrFirmId, String athorizationGuid, String gfrUserId, String gfrIpAddress, String documentId, Int32 pageNumber, Int32 pageSize, String localRootPath, String smartToken, Boolean smartInclude, Boolean refresh, Int32 rotationAngle) in C:\gj\tfs\source\AF\Dev\AF.Services\DocumentManagement\Preview\PreviewDocumentService.cs:line 118 ((null)/(null)) [CL-AFDVAP-01, /LM/W3SVC/1/ROOT-1-131607609635694603, 17, ConvertNConsecutivePagesToHtmlStackTracegj()]

This happens mostly when scheduler complete doc processing and when web code try to retrieve the document content

As you can see the error is throwing at
List pages = _htmlHandler.GetPages(documentPath, options);

please let us know if you have any suggestion for Mutex error.This is happening mostly for small files.Larger files never shown this error

Our OrderID is180103043152.To get faster response please let us know any other way we can do fast ticket?.These error are frustrating and affecting our deadlines

Does this has anything to do with the web running account “portaldev\svc.afwebpool”
This account has full permission to networkpath, but does the same account has to be admin on the web server also?Your permission error anything to do with account is not admin to web server?

@philipthomas32,

Thanks for providing the details. Please note that GroupDocs.Viewer uses the locking mechanism when reading content from the cache and this lock works among multiple processes to escape from any exception. However, the API releases the document and the cache files as soon as it has completed its operation. Whereas, the exception details you shared confirms that is the issue is related to the permissions.

As you said the issue occurs occasionally and it doesn’t occur when the scheduler and the web application run on different machines, it confirms that the issue is specific to your application and is purely related to the permissions for the location where the cached file is located and not related to the API. Please re-check that svc.afwebpool user has the appropriate access rights to the folder where the files are located. You can also monitor the permissions before and after the exception to check if they are not getting changed by some other process beyond your awareness (see this). Furthermore, you can also try to manually dispose off all the objects (or use using statement) when scheduler completes processing the document. And yes, you can also try to give the svc.afwebpool user the admin access to the cache folder. Hope it helps.

Thanks for your reply.

As you know this is something you should at least address to your developer

The error is from your method _htmlHandler.GetPages(documentPath, options);It happens rarely ,its a mutex error.What mutex error means to you.

We gave full access for web account to networkpath where source file and cache folder are located
But why we have to make web account as administrator on the web server machine?

Does your GROUPDOC dll need running account to be run as administrator?

We will keep an eye to make sure this error will not occasionally happen again running as administrator.But please share mutex error to development and give us the steps we have to take.

@philipthomas32,

Thanks for your response and we’ll do our best to guide you in this scenario.

The API does not require to be run as administrator. It may only use read/write/modify permissions for the folder(s) where it needs to read/create the files, i.e. storage and cache directories. Furthermore, as the issue occurs occasionally, you may also check if some other process is not interrupting and changing the permissions beyond your awareness.

In that case, we would like you to create and provide us a complete sample application (web/console) and the scheduler that can be used to reproduce the issue. The sample application and the scheduler may only contain the part of the functionality that uses GroupDocs.Viewer (excluding the functionality specific to your application/business case) in your application where the issue is happening at your end. Furthermore, please also provide us the details about the OS and version of .NET framework. You may also provide us the step by step guidelines that might help us to reproduce the issue at our end using your provided sample application. We shall be looking forward to your response.

Even running web account as admin to the web server machine gives the mutex error like 1% of the time.
I gave you more information anybody can give , even stack trace on mutex error.Please check with developer on the scenarios where getpages method can give mutex error?I want to give you an heads up.We are a paid customer , we expect some explanation from development.If you look this thread, i gave you as much information as i can.Based on the stack trace, you give us some guidelines,we dont want to go and forth on this thread.Take your time and give us some guidelines

@philipthomas32,

Thanks for your response. We understand that the issue is causing inconvenience on your end. However, some prerequisites are necessary for us in order to investigate the issue in the same environment (OS and the .NET framework) that you are using. Furthermore, we are also requiring a sample implementation of how you are using the API features in your application because the issue can also be the application specific. Therefore, we asked for some more information in the previous reply and we appreciate your cooperation to move further towards the resolution of the issue.

We expect 2 things from you

1)Our .net framework is 4.0.We were able to reprdocue the same error in on our local development win 7 machine and our dev enviornment windows 2012 servers. The error is from your GetPages method with your simple inputs.The error is mutex error .With common sense we know it has something to do with your caching code.Based on the stack trace error, you give us the best judgement on what to do next if we put a try catch and if this exception happen ,what is the next retry,we tried calling same method again on exception we get same cache xml denied error.

  1. I will try to create a shell for you to get an idea on our application and will send you.Our scheduler is a .net window service. The back end is wcf rest servivce where we see this error when reading cached data

NOtes:We dont want to kill every day waiting for one response.You can give an explanation on item 1 to start with.We will give you a shell soon

@philipthomas32,

Thanks for providing the required details.

We tested to render the documents that are located in the network path and also tried to read the cache maintained on the network path many times in the same environment as you have but could not reproduce the issue. However, we are investigating the exception you are facing to check if we can get any idea of the reason behind it. As soon as we get any useful information, we’ll share that with you.

We shall be looking forward to hearing from your side.

That will be great if your development can give some extra information related to mutex error