Running WCF host in Docker Container (Console Applciation) - wcf

I am working on a legacy project. My task is to run the project in the container. It is a WCF service. As a console application (or windows application) it is working perfectly fine. However, when I add a docker support (see docker file below), and perform a build (creating an image and container) it ends up with following message (in debug).
Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.
The program '[1920] WcfHost.exe' has exited with code 0 (0x0).
Docker file (automatically created when I add docker support)
FROM microsoft/dotnet-framework:4.7.1-windowsservercore-1709
ARG source
WORKDIR /app
EXPOSE 83
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["C:\\\app\\\WcfHost"]
As console application (or windows application) it works perfectly fine and there is no issue.

Related

dotnet.exe .NET Host from commandLine

When I run my webapi project in VSCode, it is hosted in dotnet.exe .NET Host. Often the process is left open after closing VSCode. It it possible to communicate with it using commandLine?

How to run blazor wasm in jetbrains rider

I am using latest MacOS and latest version of Rider.
Seeking advise on how to set up build configuration for a hosted blazor wasm project. Created with this command:
dotnet new blazorwasm --hosted -o blazorhosted
I cd into blazorhosted/server and execute
dotnet run watch
and everything works as expected.
But I don't know how to run it in Rider. As a side not also works in VS Code with debugging on client and server.
This is the error I am getting when running the server configuration in Rider
Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(184, 5): Duplicate base paths '/'
for content root paths '/Users/mha/projects/blazorhosted/Client/bin/Debug/netstandard2.1/wwwroot/'
and '/Users/mha/projects/blazorhosted/Client/wwwroot/'.
('/Users/mha/projects/blazorhosted/Client/obj/Debug/netstandard2.1/blazor/unlinked/blazorhosted.Client.dll',
'/Users/mha/projects/blazorhosted/Client/wwwroot/css/app.css')

Attaching to process over SSH with VS2019 and ASP.NET core not working

I am running an asp.net docker container remotely. I have enabled SSH, mapped the port and also installed VSDBG in the container.
In visual studio I am able to attach to process over SSH. I choose my project dll file. There are no error alerts and it appears to be debugging but on every breakpoint there is this message:
The breakpoint will not currently be hit. The breakpoint is pending and will be resolved when debugging starts.
Also if I open modules window there is no entries.
What is going on? Why is remoe debugging not working?
There are usually two reasons:
1. project publication made with release instead of debug configuration
2. the projects are not consistent. There is a difference between the project on the local machine and the server.

Install ASP.NET Core Runtime using PowerShell without internet access

I would like to be able to install ASP.NET Core runtime during a release in Azure DevOps (if its missing om the target machine), however My remote machines does not have internet access.
This https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script appears to be the "official" way of doing this, but it from the look of it this requires an internet access till be able to download the .exe from the Azure Feed(?).
Has anyone been able to modify this so it downloads the file from a place located on the local network path/url?
I succeeded to install .Net Core SDK when I have the .exe in my local drive, I assuming it's the same thing for the .Net Core runtime file.
Just not use the PowerShell installation script and install the .exe in the Command Line. in .yaml pipeline:
- script: |
"D:\dotnet-runtime.exe" /s
TIMEOUT /T 500 /nobreak
Explanation:
"D:\dotnet-runtime.exe" start to install the .exe file (replace it with your .exe path).
/s - Silent mode (no popup and "next" buttons).
TIMEOUT /T 500 /nobreak - To make the CMD waiting until the installation will be finished (without it the pipeline move on and the installation cancelled).

Deploying a .Net application built in VSTS to a remote agent machine

I have been trying to figure this out for a few days to no avail.
I have an MVC .Net Application that is stored in a GIT repo in VSTS. When I check in code it is being built and unit testa are being run in the cloud.
Now If these unit tests succeed I would like the project to be deployed to a remote machine that has the VSTS agent installed. I can see the agent in the VSTS web interface but I don't know how I get the automatic build to send the completed build to d:/mydeploypath on the remote agent machine.
Is this possible?
Absolutely possible!
There are build steps available to copy files to a remote machine such as Copy Files over SSH and Windows Machine File Copy. But if you are trying to deploy the code to the machine you are building on, you can use the Copy Files step since it won't require credentials. Since it is a web application, there are a few steps like IIS Utilities to stop\start the application pool so the files won't be locked for the deployment.
So using the Copy Files build step, you could use $(Agent.BuildDirectory) as the source directory (or wherever you have your build output going) and set the target folder to your desired destination on the machine.
The build/release variables helped me out a lot during the development of our release process:
https://learn.microsoft.com/en-us/vsts/pipelines/build/variables?view=vsts
The easy way is using WinRM-IIS Web App Deployment task.
To generate the web deployment package, you can specify these arguments in MSBuild Arguments box of Visual Studio Build task:
/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageLocation="$(build.artifactstagingdirectory)" /P:PackageTempRootDir=""