I have an Asp web api application using .net 5. The application is using Playwright to generate pdfs. It works locally on iis without any issues.
When I run it using docker windows containers on the following image:
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
it complains about missing Chromium. I tried installing playwright on that image using multiple ways but failed. The image doesn't have dotnet .sdk installed nor powershell. In my bin folder I do have playwright installation files at:
bin\Debug\net5.0\.playwright\node\win32_x64
If I run from there:
playwright.cmd /install
It downloads and installs browser binaries but in my Asp app I'm now getting error about missing dependencies:
PlaywrightException: Host system is missing dependencies!
Full list of missing libraries: dwrite.dll uiautomationcore.dll
winspool.drv dxgi.dll
I tried similar approach on Linux containers but with similar results. The approach from the Playwright tutorial using "dotnet tool" command doesn't work, because there is no dotnet sdk.
What is the best way to make Playwright work on that asp image?
Related
I am getting issue "Unable to load DLL ‘PDFNetC’ or one of its dependencies" when running pdftron .net core in windows docker container.
Where should I add the “PDFNetC.dll” in container to make this work. I have added it at all the possible locations but not working
What is The Correct(tm) way for an Electron application to run both as a desktop application and as a service?
I have looked high and low for this but to no avail. This is how I think it should work.
Create a launchd/systemd/windows service description that:
Sets ELECTRON_RUN_AS_NODE environment variable
Runs the packaged Electron application
Produces happiness?
Can the packaged Electron application run in this manner access the contents of the ASAR file? If it can, great.
Then just build and package two directories with the application. Both compiled for the ABI version Electron is on:
Directory electron_modules with binary modules compiled for an executable that reports being electron
Directory node_modules with binary modules compiled for an executable that reports being node
With the appropriate NODE_PATH also set in the service description, I should be all golden.
Right?
I am not 100% sure what the OP is asking but I found this question while looking for: how do I run an Electron application as a desktop application and also as a CLI service with no access to a display driver?
The answer from here is
Being based on Chromium, Electron requires a display driver to function. If Chromium can't find a display driver, Electron will fail to launch ... In essence, we need to use a virtual display driver.
The solution (on linux at least)
Install xvfb
Prefix your start command with xvfb-run e.g. xvfb-run node_modules/electron/dist/electron .
This is my first foyer into .Net Core and App Engines, so please forgive me if I sound uninformed.
We have a .Net Core Application that we're trying to get published to a GCP App engine (obviously). when I run dotnet publish -c Release it builds just fine without any errors. When I test the program locally it runs just fine and I'm able to access it. However whenever I try to get it on GCP I get the following error:
Updating service [default] (this may take several minutes)...
.................................................................................................................................................failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
Error:
An assembly specified in the application dependencies manifest (ApplicationName.deps.json) was not found:
package: 'Microsoft.AspNetCore.Mvc.Abstractions', version: '2.0.2'
path: 'lib/netstandard2.0/Microsoft.AspNetCore.Mvc.Abstractions.dll'
This assembly was expected to be in the local runtime store as the application was published using the following target manifest files:
aspnetcore-store-2.0.5.xml
Failed to deploy project WebApiDotNetCore to App Engine Flex.
We tried removing it from the dependencies JSON, and that just ended up breaking everything, so it is indeed required. It is installed in the project via nuget, so it should be included with dotnet restore. I've looked around and some sources seem to think that it's the installation of the dotnet core sdk, but I've tried it on three computers and always get the same thing.
Lastly, I should say this happens when I try to deploy through command line as well as directly through Visual Studio with the GCP SDK.
Has anyone experienced this error, or something similar? Any advice or guidance is very much appreciated.
Thanks!
-BT
OP REVISION
As an update I was able to get this resolved aside from the fact that I get a 502 error when I try to load the application. Here are the steps I took for anyone else that is looking what to do:
Pre-reqs: Docker for Windows and Google Cloud SDK installed and running. Running turned out to be a pain with Docker for Windows. Many many restarts and reinstallations.
Open the solution and ensure that the startup project is set correctly.
Right click the startup Project, and select Add > Docker Support.
Select Linux in the popup window and allow the files to be created.
When complete, the Dockerfile should appear in the preview window. Do the following:
For me the first line read: FROM microsoft/aspnetcore:2.0 AS base. Change this to FROM microsoft/aspnetcore-build:2.0 AS base.
Additionally, check to make sure that the last line has the correct .dll name. Docker for Windows will put whatever the project name is rather than the class name, so for me my final .dll names were different than the project name.
Lastly, if your project has any dependencies that are required to run but not to build, then you'll need to manually add them. For me we have a couple of XML files that needed to be put in the app folder, so I had to add COPY *.xml /app/ and put those files in the same folder as the solution file is in.
If there's anything else you need to do to the Dockerfile I highly recommend this page. It's a how-to on all Dockerfile commands written in ENGLISH! (that was my biggest problem with all of this - I have little experience with Linux and even less with Docker and everything was written in Greek for me).
Create an app.yaml file. I just used the standard:
runtime: custom
env: flex
Copy the Dockerfile found in the startup project's folder into the folder with the solution.
Initialize gcloud to the right project, then navigate to the solution folder. The type gcloud app deploy app.yaml, and follow the onscreen guide.
for me it takes about 15 minutes to deploy the GCP, so depending on the complexity of your project it may take longer, though this one is rather complex.
Now I'm trying to figure out my 502 error... I've tried what seems like everything - changing the listening port in the application, exposing the listening port on the dockerfile, trying to get GCP to open that port, and trying half a dozen different ports. It's slow-going since it's such a chore to deploy each time.
Hope this helps anyone that was like me a couple weeks ago and had never even heard of Docker!
Which version of .NET Core is this? Also, have you tried to run in Cloud Shell? Maybe that will provide more clues on what might be wrong.
It looks that you don't have the Microsoft.AspNetCore.Mvc.Abstractions library installed in your system. Using the .NET CLI, type the following command:
dotnet add package Microsoft.AspNetCore.Mvc.Abstractions --version 2.0.2
After that, to ensure the library is included, run the following:
dotnet restore
dotnet build
Try running it locally (it should work), and then use the dotnet publish -c Release command again.
I have a little dotnet core app which I use.
I've been running it on my virtualbox-based docker on my development PCs by pulling it from GIT and restoring and running it from a bash shell.
Now I am using a Windows Server with Docker EE installed - I've got a container built from the microsoft/dotnet image (based on Windows Nanoserver) but while it restores ok, when trying to run I get an error.
The specified framework 'Microsoft.NETCore.App', version '1.0.5' was
not found.
How can I install a version of framework from the command line or powershell in this nanoserver installation?
Or should I be looking at another method?
Well, the simplest answer was to just use a version of the docker image with the appropriate version of dotnet core installed: microsoft/dotnet:1.0.5-sdk-nanoserver
For installations in an existing container the dockerfile might provide some clue:
https://github.com/dotnet/dotnet-docker/blob/master/1.0/sdk/nanoserver/Dockerfile
I have published an asp.net vnext application using,
dnu publish --runtime 1.0.0-rc1-update1 --framework dnxcore50 --no-source
after this If I generate a docker container,
FROM microsoft/aspnet:1.0.0-rc1-update1-coreclr
ADD ./bin/output/approot /app WORKDIR /app
EXPOSE 8080 ENTRYPOINT ["./web1"]
If I run this using "docker run" command, then I see there is a problem with System.Net.Security. I also read some related issues with deploying to Linux, + some blogs which instruct on how to do "dnu publish" with linux runtime in a LINUX OS (ex: Ubuntu).
If I have to build in a LINUX OS to target LINUX, then that beats the purpose of cross-platform. In some blogs I also read, just by doing dnu restore from the source it will be good enough, problem is I have a complicated source folder setup, and I don't want to write long build scripts for Dockerfile that will help me copy all the required source + dependent source projects, and then create a DNX image of the app (very tedious).
Does anyone have a simple solution for this?
I found the issue was with the nuget packaging for System.Net.Security package.
https://www.nuget.org/packages/System.Net.Security/4.0.0-beta-23516
This version doesn't include the package for dnxcore50, but the one previous to that has it defined,
https://www.nuget.org/packages/System.Net.Security/4.0.0-beta-23409
Downgraded to use this and this issue is solved. Doh! silly issues by the MS team.