Posted on

How to Deploy ASP.NET Core Web API on IIS Windows Server

(Tested on windows server 2012r2)

Install the .NET Core Hosting Bundle on Windows Server

The .NET Core Hosting bundle is an installer for the .NET Core Runtime and the ASP.NET Core Module. The bundle allows ASP.NET Core apps to run with IIS.

Current version:.NET Core Hosting Bundle installer (direct download)

(for this test we installed version .Net Core 8 on win 2012r2)

Visual Studio : Publish on Folder

After creating the ASP.NET Core application in Visual Studio, we can use the Visual Studio Publish Tool to deploy and run our app. For this project, choose to publish to a folder. Choose the folder and hit “Finish”.

In the next screen, where you see the settings for this deploy, click on “More Actions” and then on “Edit”.

Select :

  • Deployment Mode : Complete
  • Target Runtime : win-x64 (for our server)
  • File Publish Options : Delete all existing files prior to publish (flagged)
  • Database : Default Connection edit (if yuu need it)

Save this configuration, control it an Publish.

Copy the contents of the folder on the IIS server to the folder dedicated to the new site.

IIS and new site

Create the site on IIS. For the Application Pool you have to use default .NET CLR Version : v4.0.

Open your browser and call up the site. You receive the “page not found” error (404).

Remember that a site that hosts only calls web api. To verify that it works you can use the controller that Visual Studio sets by default when creating a site. Then type:

https://www.mynewapisite.com/WeatherForecast

and you will get a result. The site works!

Posted on

c# and shadow copy – notes on library AlphaVSS

AlphaVSS

AlphaVSS is a .NET class library providing a managed API for the Volume Shadow Copy Service also known as VSS

Error loading library AlphaVSS.x64.dll

if you have error loading the library probabilly you need to install on the machine the Visual C++ 2017 Redist package.

You can find it at this link

Control shadow copy

To control shadow copy, created using alphavss library, you have to open a command prompt whith administrative priviliges and type

vssadmin

to list your shadow copy you have to type :

vssadmin list shadows

 

Posted on

Windows server – Active Directory – useful links

Move active directory roles from a domanin controller ti another

VERIFICARE E MODIFICARE I RUOLI FSMO DI UN DOMINIO WINDOWS

Backup Domain Controller

Aggiungere un Backup Domain Controller ad un dominio Active Directory esistente

Installing licenses for Remote Desktop

Licensing Mode for Remote Desktop Session Host is not Configured

Modalità gestione licenze di Desktop remoto non configurata

Posted on

Fix Windows Update errors

Open Start, type: CMD
Right click CMD
Click Run as administrator

Type each of the following then hit Enter

taskkill /f /fi "SERVICES eq wuauserv" (Do this multiple times)
net stop cryptSvc
net stop bits
net stop msiserver
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
rmdir C:\Windows\SoftwareDistribution\DataStore
rmdir C:\Windows\SoftwareDistribution\Download

When complete, hit Enter, then restart, then try updating again.

If that does not work..

1. Open Start, type: CMD
Right click CMD
Click Run as administrator

Type each of the following then hit Enter

Run these codes:

Net Stop bits
Net Stop wuauserv
Net Stop appidsvc
Net Stop cryptsvc
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak
Net Start bits
Net Start wuauserv
Net Start appidsvc
Net Start cryptsvc

After running these commands, check if your issue is fixed.