Ran into a strange phenomena:
in Application A, the code:
Using sr = New StreamReader(path)
runs perfectly (where path is C:\tmp for example. The directory is on the local machine).
In Application B the same line, on the same directory throws the exception: "Access to the path is denied".
This happens when run in the IDE or by activating the exe file.
Some additional information:
Windows 7 Pro, 64bit VS 2013
The app.manifest of both application is identical. I've tried changing to all possible options of requestedExecutionLevel but the result was the same.
The target framework of the application is 4.
The exception is thrown whether I run as administrator or not.
I've set the permissions of the directory to full control for all accounts (including Administrator and Everyone).
I've deleted the directory and recreated it. Didn't help.
Ran Farbar scan which did not report any problems.
Application A is referencing the FILE C:\tmp. I expect this file isnt present on Application B's machine.
http://msdn.microsoft.com/en-us/library/vstudio/f2ke0fzy
Also ensure you are properly disposing of your StreamReader class after use. if you dont do this the file can remain locked.
Related
I had recently upgraded to Visual studio 2019 from 2017. The tests (xunit) was working fantastic until this update. But after updating, when i run my tests it just says "Outcomes Not Run".!!! strange, even it doesn't shows any details of any error under Output window, later found we have to manually change
"Show output from: " drop-down in Output window to "Tests" to see that. I got these details as below
System.Runtime.InteropServices.COMException (0x89710016): Unable to start program C:\Users\bb00001\.nuget\packages\microsoft.testplatform.testhost\16.5.0\build\netcoreapp2.1\x64\testhost.exe.
This program is blocked by group policy. For more information, contact your system administrator.
Since I works in a very restrictive environment, understood i cant run any exes under that location since GP restriction. But got access to particular locations under C Drive.
Is there anyway I can change my testhost.exe file location? which visual studio can pickup the exe from a configured path?
After referring the link https://learn.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders,
I had set an environmental variable like below, where i set a new nuget-package source which my group policy allows me to run applications
This will automatically override the default location to newly setup location. Later restart the visual studio and rebuild the solution, it must add all the dependencies to new location. It worked for me. Not sure this issue will occur to anyone else, but maybe helpful, if someone with need.
Am using Windows Server machine 2012 R2 machine to take a setup (exe) and using Wix v3.10.
When i run the burn executable taken from Windows Server 2012 R2 machine in any machine, setup crashed with the error as "System.IO.DirectoryNotFound" not found.
On further investigating this, this exception was occurred during the retrieval of burn and bootstrapper related files(.ba folders from temp location) using WixBundleProviderkey. Because, the .ba folder was existing in some other (some Guild(folder name)} name instead of the required directory in temp location. This issue is occurred only when the setup taken from Windows Server 2012 R2 machine and this is not occurred in some other windows machine if we took setup from it.
Actual path in which .ba folders exists: C:\Users\server\AppData\Local\Temp\2{32DB2298-79D9-4816-9BD6-ABA4271CCA2F}
Application Searching path of .ba folder : C:\Users\server\AppData\Local\Temp\2{36823a7e-b6d2-4db1-b0d1-212cdf7bd669}\
Could anyone please let us know why this issue occurring in Windows server machine?
What is the main function of WixBundleProviderkey?
Below is my code where am facing issue while launching the setup
string baFolder = System.IO.Path.GetTempPath() + SyncBA.Model.Bootstrapper.Engine.StringVariables["WixBundleProviderKey"] + "\";
This is due to the security mitigations added in v3.10.3. That temp folder is no longer created using the bundle's id, it's a random guid. You should get the location of your BA in a different way, such as AppDomain.CurrentDomain.BaseDirectory.
This is a problem I have never seen before. Whenever I run a certain command in my application, I am getting the error:
Could not load file or assembly 'CADB.Data'. The system could not find the file specified.
When I run the command in the debugger, I do not get this error. The system completes the process successfully. It is only when I am running the built .exe. The .exe is in my debug folder with all of the necessary DLLs (Copy Local = True) including the problem DLL (CADB.Data).
When the system runs this command, it is under impersonation. I put the Debug folder (containing .exe and DLLs) into a folder the impersonated user has full access to. I checked access in the Security tab of file properties, and the user has full access to the folder AND CADB.Data.dll. Still, I get the error message above. When I run the program through any other folder that the impersonated user does not have access to, I get a slightly different error: Could not load file or assembly 'CADB.Data'. Access is denied.
Running the application through the debugger on another workstation throws the error as well. The error occurs at the declaration of the method GetClaimGuidList which is a member of CADB.Data (below).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using CADB.Data;
namespace CADB.BusinessServices
{
public class ClaimHelper
{
static public List<Entities.Claim> GetClaimGuidList(int caseId, bool includeNotices)
{
DataTable dt = ClaimCmd.GetClaimGuids(caseId, includeNotices);
return Utilities.MapDataTableToList<Entities.Claim>(dt);
}
}
}
Other things tried:
Setting DLL as read/write. It was read-only because the file was originally being edited by VSO and thus had a read-only mark.
Running process monitor to look for an access denied message. I don't find such a message anywhere in the monitor.
Removing the DLL and adding it again from the project (my solution has multiple projects).
Cleaning the entire solution, re-building and re-running the EXE
Deleting the bin folder of every project in the solution, re-building and re-trying
Can anyone help? Any ideas would be greatly appreciated. Thanks.
For some reason, the impersonated user did not have access to the application files created in the bin folder. I went to the Security properties of the folder and added that user to the folder with full access rights. This allowed us to bypass the error. Why the user was not able to access the CADB.Data DLL is still a mystery. In any case, the issue was not present in the published ClickOnce application.
I have create Office Excel application in my machine(XP). and i have placed the application in windows server 2008 giving the following error.
Microsoft Office Excel cannot access the file '\server\Input.xls'. There are several possible reasons:
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook.
both client and server systems installed office 2007 and added reference microsoftexcellibrary 12.0
created assembly for the application and calling the code from the form.
I was getting the exact same error, although in my case I was trying to run (from Tidal Enterprise Scheduler) a .NET app that used microsoft.interop.excel.
The answer is already in stackoverflow:
[Microsoft Office Excel cannot access the file 'c:\inetpub\wwwroot\Timesheet\App_Data\Template.xlsx'.
I'll re-list the steps from that link:
Create directory “C:\Windows\SysWOW64\config\systemprofile\Desktop” (for 64 bit Windows) or “C:\Windows\System32\config\systemprofile\Desktop” (for 32 bit Windows)
Set full control permissions on Desktop directory above (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user “IIS AppPool\DefaultAppPool”)
Of course, if you're running a scheduled task rather than WebApp, you'll need to make sure the service account you're using has permissions on that folder.
I had the same error when trying to save to:
C:\test.xlsx
When attempting to save to the root directory, it seemed to cause problems. Changing my path to:
C:\MyExcelTests\test.xlsx
Worked fine
I would make sure no Excel processes are running on the machine before you run this application, that should cover the last point.
The first point looks the most likely issue, the path looks like a partial path or an incorrect UNC path. Try putting the full path to the spreadsheet 'C:\server\input.xls' and see if that works.
To stop the middle point, in the workbook.open command you can specify to open as read-only, this will make sure the application can red the file even if it is locked open by another user.
I'm trying to run some VBSCRIPT from within my application. This works fine when I run my program from within VB. But once I add "UIAccess=true" to my manifest and digitally sign my exe with my certificate, I am unable to run the code any more. It gives errors when I try to interface with any program saying "429: ActiveX component can't create object: 'myApp.Application'". Anyone have any idea why it would run fine in the IDE but not with an application with uses UIAccess? Here is the code:
Dim scriptRunner As New MSScriptControl.ScriptControlClass
scriptRunner.Language = "VBScript"
scriptRunner.AllowUI = True
scriptRunner.Timeout = 3000
scriptRunner.AddCode(scriptStr)
scriptRunner = Nothing
In googling around, I found this website.
it says
Applications with the uiAccess flag set to true must be Authenticode signed to start properly. In addition, the application must reside in a protected location in the file system. \Program Files\ and \windows\system32\ are currently the two allowable protected locations.
maybe it works in your IDE because your IDE is within \program Files\, but outside of your IDE you are running the signed application NOT within \program files or \windows\system32