"Required permissions cannot be acquired" while debugging standalone application - c#

I'm trying to debug a native application that uses some C# components but I'm getting a "Required permissions cannot be acquired" error when trying to start the application.
Now I did search StackOverflow and the net in general but all answers that I could find were related to ASP Web applications but the one I'm trying to debug is a standalone one.
Additional background: I'm using WinDbg to debug code that runs in a remote machine via remote terminal (in fact by using TWO remote connections since the machine in question is not reachable from my machine directly thanks to some stupid router configuration). The binaries are located on my computer and I access them via the auto drive mapping that RT does for me.
Now I did have similar issues in the past and I'm pretty sure that the code would run if I copy all the binaries to the target machine and start them from a local drive but this is something that I want to avoid.
NOTE: The code is targeting version 2.0 of the .Net Framework. The target machine does not have the configuration tool for .Net 2 installed and I gave up trying to install and make it run by hand to try to see if there is some "trust" setting that I can set to mke the code run..

Problem turned out to be a firewall issue and related to the fact that I could not reach the target machine (where the program was running) directly from my PC (where the executable files where located). I was connecting indirectly through another PC to the target machine and this was causing problems with the .Net security checks, after changing the switch/firewall so that I could connect directly I had no more problems.

Related

Windows Form app won't run at startup but will run manually

I'm attempting to run an app on startup on a Dell laptop running Windows 10 Enterprise. It is written in C# using Visual Studio. The app is meant to run with administrator privileges. If I manually start the app, it works just fine. When I attempt to run it automatically using local group policy editor, it gives me the following error on login: "This application could not be started."
I looked up that error and wound up at the following link: https://support.microsoft.com/en-us/help/2715633/shim-errors-for-the-net-framework-version-and-platform-support. It said: "The app is not configured in a way that makes it possible to determine the appropriate version of the .NET Framework runtime. The corresponding shim code is SHIM_NOVERSION_FOUND."
I used information found here: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed to determine which .NET frameworks were installed on the target device. There were a few, including version 4.0.
I added a config file to my project using instructions from the following link: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-configure-an-app-to-support-net-framework-4-or-4-5.
When I rebuild the project and try to run it on the target machine, I get the same error as before.
NOTE: The target computer is under a group policy which may or may not be affecting the app. We don't know.
My ultimate solution for this problem was to build an installer for the program instead of just copying the release version over to the laptops manually

Deploying C# WinForm applications works on most machines, but not all

I have made a winform application for my company to use, as we are using it to replace some functionality of other internal applications, and I am to make sure the application works on all machines (mostly bare-bones machines with just .NET 4+).
The application will not load at all on one user's machine, and I have added logging functionality, but it does not help in this case, as this user cannot load the application.
I have made sure of the following sanity-checks:
The proper .NET configuration is installed on the user's machine
Made sure all of the DLLs that the program uses are referencing the DLLs in the location of the application
The application works for all other machines tested including...
Another dev machine
My dev machine
Multiple barebones non-development machines
I have all of the DLLs required for the application to work, and nothing needs to be installed in the GAC.
Is there something else that I might be missing?
This could be permission issues, Anti-Virus preventing the application from running or a virus itself ending the life-cycle of the application (OnStart of the event).
Try to deploy on a VM again or another machine if it works, do a reset of the machine in question.

Cannot Load Type on Mono Server

I am building an ASP.NET MVC 4 website with Visual Studio 2013 on Windows 8.1. The site works well on my Windows machine, but the real problem occurs whenever I upload my application to a RedHat Linux server. The server kernel version is 2.6.32-431.23.3.el6.x86_64 and it runs Mono 3.0.7. Hosting is provided by Openshift running the Mono cartridge.
It used to run my application just fine on Linux (a few weeks ago), but since then I have made many changes to the application (not the server). I did not change the required .NET runtime. It displays this error when I load the home page:
It says that it cannot locate the core business-logic class that I created to construct my home page, OpenShift.Business.Home.Introduction. The namespace and class name is correct, as it worked on Windows. The Openshift assembly that it uses is present, I checked the Linux file system. The error logs from Mono are not helpful for this issue.
Does anyone know how to begin resolving this issue?
It turns out that the .gitignore file was not pushing up any of the DLLs in my bin folder. So they existed, on my local Windows machine, but were never pushed to the Linux server. I removed that folder from .gitignore, committed and pushed again, and everything works just like it did on Windows.

WPF Error on Non-Development PC - XamlParse

I have an error very similar to the one addressed in this question. I am trying to deploy a small c#/Xaml utility on 6 work machines. 4 of the machines run the utility successfully and 2 do not. All machines are windows XP and have .Net frameworks 1-4 installed (my app is compiled against 4.0 and all machines have both client and extended redistributables installed).
On running the utility, I get the standard "... has encountered a problem and needs to close." On viewing the error report contents, the problem seems to occur in System.Windows.Markup.XamlParse.
I have run .Net 4.0 online installer in "repair" mode and still I get the same problem. I have tried all the suggestions from the post linked above:
The file is deployed alongside a DLL which is present and correct.
UI cultures are identical.
All computers are up to date from Microsoft Update.
The assembly does not contain any external resources which are referenced in XAML.
I don't really know where to start with debugging this one. Any suggestions?
I would suggest setting up remote debugging on the machines that are having the problem and then adding this to the startup code:
while (!System.Diagnostics.Debugger.IsAttached)
{
Thread.Sleep(100);
}

Running a C# exe file

Duplicate:
Why does my .NET application crash when run from a network drive?
Can someone help me? For a school project, I wrote a C# windows application in Visual Studio 2005. It works just fine, no problems. I want to be able to share this program with others in my department at work. So, I copied the exe file to a network drive. When we attempt to run the exe from the network, it fails with "name of progrm...has encountered a problem and needs to close". If I have the co-worker copy the exe file to their c:\ drive then attempt to run, it works. Why won't my program run from the network drive?
Susan
.NET by default does not allow applications to be run off a network drive. Either copy it to a local drive or alter the security settings for .NET.
This discussion should give you what you need.
Microsoft has finally realised that the default behavior of preventing applications from running off a network drive is wrong. From The .NET 3.5 SP1 download page:
"Additionally, managed applications that are opened from network shares have the same behavior as native applications by running with full trust."
This change is long overdue: there is virtually no security benefit in preventing managed applications running from a network share, since a hacker could just as easily use an unmanaged application.

Categories

Resources