I created a .net core 5 web api and planned to run using docker
with Visual studio 2019. While trying to run api in docker end up with error,
Docker Desktop is not functioning as expected. Please try restarting Docker.
I was not able to run the application in windows my local system.
Well, I suppose you get this because your VS is not able to communicate with docker daemon which opens a net.pipe. To justify this try the below command in a command line:
>docker run hello-world
Regardless you have a "hello-world" container, if you get the following error: "Error response from daemon: open \.\pipe\docker_engine_windows: The system cannot find the file specified".
This means you are probably missing some Windows features. Run the following command from an elevated Powershell:
Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All
Then it will ask to restart your computer, then docker stuffs shall work from VS.
I had this problem recently and used this GitHub issue which helped me solving the problem. Hope this helps on you too...
Related
I am building a .NET 6 application in C# using Visual Studio 2022. The application has a worker service that runs a console application. A Group Managed Service Account (gMSA) has been created for me and I can successfully install the service (using PowerShell) under the gMSA credentials on my local PC as well as a staging server. The gMSA passes Active Directory credentials from the service context to my application and works correctly. However, I do not have a way to debug my application using the gMSA account on my local PC.
Using a container or Azure is not an option and because this is a console application, an IIS-based solution is not possible either. I initially thought I would use runas to log into Visual Studio 2022 as the gMSA, but learned that runas would not work with a gMSA and that the preferred method to log into an application as a gMSA would be to use PsExec (64-bit version).
I attempted to do this, but was only able to log in via a command prompt as "nt authority\system" using
C:\psexec\PSExec64.exe -s cmd.exe
When I would attempt to log into the gMSA using
C:\psexec\PSExec64.exe \\local_pc\c$ -i -u gMSA_username -p ~ cmd.exe
no error message was displayed, but also no Microsoft copyright message (which is what is displayed when the command is successful). This seems to suggest the command failed in a way that could not be reflected in an error message. (It is worth mentioning that I also tried using both commands to open up a PSExec pipe and then connect using a gMSA, but I could not get that process to work.)
Adding to this issue is that Visual Studio 2022 no longer offers the "Start external program" functionality under the Debug section of a project's properties. So even if I was able to run a command prompt under a gMSA, I do not know how I could use that knowledge to log into Visual Studio under the gMSA credentials.
I would like to know how to debug my console application running as a service in Visual Studio 2022 using a gMSA. I am willing to do this using PSExec or another method. Any assistance offered will be greatly appreciated.
There were a couple of issues I had to resolve to be able to debug my .NET 6 service running a console application in Visual Studio 2022 using a gMSA. Here is how I got this to work:
At some point while I was trying to resolve my issues, the gMSA membership for my development PC was removed by another person in my IT Department. As it was explained to me, another computer was added to the gMSA, but the PowerShell command that was used overwrote the existing gMSA membership, including my development PC (the command adding a new computer to the gMSA membership should have included my development PC and any other existing gMSA computer members). Once this was resolved, I could tackle other issues.
Because I could find no way to share the gMSA context directly within my development environment (Visual Studio has no means, to my understanding, of running as a system process, gMSA, or an impersonation of a gMSA) I decided to try to attach a debugger to the service while it was running. This did not work until I discovered an SO post on a bug in the Visual Studio Just-In-Time Debugger. Per this post I navigated to
Computer\HKEY_CLASSES_ROOT\AppID\{E62A7A31-6025-408E-87F6-81AEB0DC9347}
in my development PC's registry and changed the value of AppIDFlags from 0x28 to 0x8. This got the Just-Time-Debugger working.
Once these issues were resolved I placed
#if DEBUG
Debugger.Launch();
#endif
in the StartAsync method of my .NET 6 worker service (worker.cs) so that the debugger would function within the gMSA context. After publishing the code to the location on my development computer that corresponds to the executable path accessed by the service I started the service and was prompted to attach the debugger. Upon doing so, I was able to debug under the gMSA context and access Active Directory via the gMSA in my Visual Studio 2022 development environment.
I wrote this small .net core app that backup and transfer mysql database from a server to a dockerized app. However, when I put it in docker and try to run it nothing happens. If there is an error in the app it should console.writeline the error message but nothing.
FROM mysql:5.7.34
COPY ./dbmover /tmp/dbmover
WORKDIR /tmp/dbmover
EXPOSE 3306
As you already figured out my released .net core app is contained in the dbmover folder and copied on the docker container.
Now if I connect to the container shell and execute the app I get no output of it. I run ./myapp.exe
There are my release settings for my app.
Note that this application is not meant to be dockerized it is just a tool to help build the container.
What am I doing wrong ?
SO I didn't noticed at first but I was publishing with visual studio instead of the command line tool. Once it is done publishing it is ginving you the path of the publish. What I ddin't notive is that it was the parent folder of the publishing folder which was linux-x64 folder. Once I took the linux-x64 subfolder instead of the main one it started working.
I am trying to publish my .Net core app docker image to Azure Container Registry using Visual Studio 2019.
It was working fine, but suddenly I started to see the following error:
Publish has encountered an error. Running the docker.exe login command
failed.
WARNING! Using --password via the CLI is insecure. Use
--password-stdin.Error response from daemon: Get https://app.azurecr.io:443/v2/: unauthorized: authentication
required
A diagnostic log has been written to the following location:
"C:\Users\user\AppData\Local\Temp\tmp768.tmp"
When running the following CMD command:
docker login https://app.azurecr.io
I am getting:
Authenticating with existing credentials...
Login Succeeded
I restarted Visual Studio and Docker, And I am running Visual Studio as Administrator.
Anyone ran into similar issue?
The solution was to:
1- run the cmd command:
docker login https://app.azurecr.io:443 port included
2- providing username and password again.
3- Publish from Visual Studio.
Note:- 'app' in the above url is the name of the registry
I'm not sure if this was solved. But I deleted the publish profile, then added it again. when I did that, it asked me to sign in to azure again. This fixed it for me.
Currently I'm developing an application for both Windows and MacOS.
Created a template application for MacOS (10.13.4) using Eto.Platform.Mac64 (2.4.1) nuget package. The application is built for Release build. The problem occurs when trying to launch the .app bundle.
Currently tried:
Opening the bundle using: open -a xxx.app. I got an error -54
using: sudo open -a xxx.app. The error is -10810
Giving all permissions for files inside for execution.
Disabling GateKeeper
Trying to launch the executable directly using mono, although the ETO platform checks if it's launched from .app bundle, and fails there
Launching the .app from /usr/local/bin
Launching the .app from ~/Applications/
Building Eto.Forms for MacOS separately.
Everything seems to point to permissions issue, but I can't seem to understand what am I missing.
Since I'm new with MacOS in general (mostly familiar with linux), any suggestions/help is greatly appreciated.
After checking the Console.app for logs I found out that com.apple.quarantine had marked the application as quarantined.
After xattr -d com.apple.quarantine MyApp.Mac.App/Contents/MacOS/MyApp.Mac
Everything works perfectly.
Thank you Curtis for your suggestions.
I was flowing this guide Quickstart, so i instaled all the things i was supposed to and created ASP.NET on Google Cloud Platform created project.
Then i created VM:
VM
And when i'm trying to publish i have that:
Publishing GcpProject1 to Compute Engine.
msbuild.exe "C:\Users\peter\source\repos\GcpProject1\GcpProject1\GcpProject1.csproj" /p:Configuration=Release /p:Platform=AnyCPU /t:WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl="C:\Users\peter\AppData\Local\Temp\fflssbvg.hc0"
Failed to publish project GcpProject1.
I turned off firewall and i have same versions of .net framework on server and locally.
Help me please to find the solution.
I just face the same problem, the error message from asp.net is short and hard to figure out.
dotnet publish -o "C:\Users\Puzzle\AppData\Local\Temp\v1opor1f.mdb" -c Release
Failed to deploy project HelloWorld to App Engine Flex.
I check other solutions , and find this works for me : https://cloudplatform.googleblog.com/2017/10/4-ways-you-can-deploy-an-ASP.NET-Core-app-to-GCP.html
just use powershell to send command and that works. hope it helps