Access to Path Denied - Magick.NET.net40.7.4.3.0 - c#

I am trying to read text from images using IronOCR. It worked fine on my dev machine but when I try run it through IIS on another machine I am getting the following error
Access to the path 'C:\Windows\TEMP\Magick.NET.net40.7.4.3.0\Magick.NET-Q8-x64.Native.dll' is denied.
there is no Magick.NET.net40.7.4.3.0 folder in the window temp folder location on the dev machine, but it was there on the other machine but it was empty. I deleted the folder and now it is saying there is access denied on the user app_data folder.
I am totally confused as to why it is looking for access to Magick.NET.net40.7.4.3.0, is there some connection between the 2?

In your code you'll need to set :
IronOcrInstallation.InstallationPath = "d:\newpath"
where d:\newpath is a directory on your IIS that your worker process or IIS has access to.
BTW IronOCR is a commercial re-bundling of the open source Magick.NET image and Tesseract OCR libraries.

Related

App OnStartup Error: Access to path 'C:\Users\<userid>\AppData\Local\AppName\VersionFolder\Some.dll' is denied

I have a desktop application that has a setup.exe built by Squirrel.
The app files get downloaded to the users machine at this location:
C:\Users\<userid>\AppData\Local\AppName\VersionFolder\
And a short cut is created on the desktop. For some users, when they run the application, they get the error
"App OnStartup Error: Access to path C:\Users\\AppData\Local\AppName\VersionFolder\Some.dll is denied."
Not sure what's going on?
It works fine for me and few other users. One of users who get this error has admin rights to their pc. Any help would be greatly appreciated.

Access denied to web server file

I'm working on a web app that runs Excel reports and I'm using an Excel template file that's saved on the server. It works fine when I run it locally but when I try to run the Excel report on the server I get an error saying access is denied to the template file that's saved in the same directory, but I can download the template file when I navigate to it in the browser.
I granted everyone full access to the file to see if that was the issue but I still get the error. What am I overlooking?
error errorId="05d6462e-8bb5-401d-85bc-cd4d9e36fc90" application="/LM/W3SVC/8/ROOT" host="USFLWCT0" type="System.UnauthorizedAccessException" message="Access to the path '\usflwct0\D$\SherlockRoot\Files\Volume_by_Week_Template.xlsx' is denied." source="mscorlib" detail="System.UnauthorizedAccessException: Access to the path '\usflwct0\D$\SherlockRoot\Files\Volume_by_Week_Template.xlsx' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at
edit:
Here's the code used to open the file. The path is hardcoded for now
using (var template = System.IO.File.OpenRead(#"\\usflwct0\D$\SherlockRoot\Files\Volume_by_Week_Template.xlsx"))
You are using one of the admin shares that Windows creates for each drive, in this case the D$ share. They are only accessible by admin level users. You should share the folder you want directly, for example, share the D:\SherlockRoot\Files folder as SherlockFiles that was you can access the content like this \\usflwct0\SherlockFiles\Volume_by_Week_Template.xlsx or in code:
var file = #"\\usflwct0\SherlockFiles\Volume_by_Week_Template.xlsx"
using (var template = System.IO.File.OpenRead(file))
If you want the application to read the the template file, put it in the App_Data folder

FileLoadException - acces denied in SharePoint application bin directory

I have following lines of code:
System.Reflection.AssemblyName assemblyName =
System.Reflection.AssemblyName.GetAssemblyName(#"C:\inetpub\wwwroot\wss\VirtualDirectories\22687\bin\log4net.dll");
After executing it, I get a System.IO.FileLoadException - Could not load file or assembly or one of its dependencies. Access is denied..
If i copy the file and try the same in a different directory (for example: #"C:\inetpub\wwwroot\wss\VirtualDirectories\22687\log4net.dll") I don't get the Exception, even if I set the permission for the file exactly the same.
Can anyone point me to the right direction?
I'm running Windows Server 2008R2, SharePoint 2010, IIS7 and Visual Studio 2010.
edit: It works on LINQPad. I run the Application from the IIS App Pool under the same user as the LINQPad Process.

Windows Azure: System.UnauthorizedAccessException: Access to the path 'E:\approot\

I have an xml file in my project that is supposed to be for used for read operations. And it works the project works fine when i run it on my local machine, however it throws System.UnauthorizedAccessException: Access to the path 'E:\approot\... when i deploy the worker role.
I have checked that the file exists in that directory.
How can i fix this issue?
Thank you.
You need to run role in elevated mode...by adding
< Runtime executionContext ="elevated" /> in csdef.

UnauthorizedAccessException when downloading a file using the TFS SDK

When I try to download a file from TFS version control SDK to my computer I receive an 'UnauthorizedAccessException' saying Access to the local path I'm trying to download to is denied. I included a stripped down version of the code I am using below.
var projectCollection = GetProjectCollection();
var versionControl = (VersionControlServer)projectCollection.GetService(typeof(VersionControlServer));
versionControl.DownloadFile('$/path to file', 'local path to download to');
Does anyone know how to resolve this issue?
I found the issue.
The second argument in DownloadFile() needs to be the file name it will be downloaded as and not the parent directory it will be placed in. I thought it just needed the directory name.
So instead of what I originally had
versionControl.DownloadFile("$/Readme.txt", "C:\\Temp");
it needs to be
versionControl.DownloadFile("$/Readme.txt", "C:\\Temp\\Readme.txt");
This is because the process does not have rights to the local path. Make sure the local path has the appropriate right set to the user that is running the process.

Categories