.NETASP.NETIIS8 min de lectura

Instalar .NET y hospedar aplicaciones ASP.NET

Instalá .NET Runtime y desplegá aplicaciones ASP.NET Core en IIS o Kestrel.


.NET es la plataforma de Microsoft para aplicaciones web, APIs y servicios. Podés hospedar con IIS o directamente con Kestrel.

Paso 1 — Instalar .NET Runtime

powershell
# Descargar el instalador
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile "dotnet-install.ps1"

# Instalar ASP.NET Core Runtime
.\dotnet-install.ps1 -Channel 8.0 -Runtime aspnetcore -InstallDir "C:\Program Files\dotnet"

# Instalar .NET Runtime completo
.\dotnet-install.ps1 -Channel 8.0 -InstallDir "C:\Program Files\dotnet"

O descargá el instalador desde https://dotnet.microsoft.com/download

Paso 2 — Verificar instalación

powershell
dotnet --info
dotnet --list-runtimes

Paso 3 — Instalar el módulo ASP.NET Core para IIS

Descargá e instalá el Hosting Bundle:

powershell
# Descargar Hosting Bundle
Invoke-WebRequest -Uri "https://download.visualstudio.microsoft.com/download/pr/hosting-bundle-8.0.x.exe" -OutFile "hosting-bundle.exe"
.\hosting-bundle.exe /install /quiet /norestart

# Reiniciar IIS
iisreset

Paso 4 — Desplegar aplicación en IIS

Publicá tu app localmente:

powershell
dotnet publish -c Release -o C:\inetpub\miapp

Creá el sitio en IIS:

powershell
New-IISSite -Name "MiApp" -PhysicalPath "C:\inetpub\miapp" -BindingInformation "*:80:miapp.midominio.com"

Configurá el Application Pool sin .NET CLR (modo No Managed Code):

powershell
Set-ItemProperty "IIS:\AppPools\MiApp" -Name "managedRuntimeVersion" -Value ""

Paso 5 — Hospedar con Kestrel (sin IIS)

Creá un servicio Windows:

powershell
sc.exe create MiAppService binPath= "C:\apps\miapp\miapp.exe --urls=http://0.0.0.0:5000" start= auto
sc.exe start MiAppService

Paso 6 — Configurar como servicio con NSSM

powershell
# Descargar NSSM
Invoke-WebRequest -Uri "https://nssm.cc/release/nssm-2.24.zip" -OutFile nssm.zip
Expand-Archive nssm.zip -DestinationPath C:\tools

# Instalar servicio
C:\tools\nssm-2.24\win64\nssm.exe install MiApp "C:\apps\miapp\miapp.exe"
C:\tools\nssm-2.24\win64\nssm.exe set MiApp AppDirectory "C:\apps\miapp"
C:\tools\nssm-2.24\win64\nssm.exe start MiApp

Paso 7 — Variables de entorno

powershell
[Environment]::SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Production", "Machine")
[Environment]::SetEnvironmentVariable("ConnectionStrings__Default", "Server=localhost;Database=miapp;...", "Machine")

Tu VPS Windows de Baires Host es ideal para hospedar aplicaciones .NET con rendimiento dedicado.


¿Te resultó útil esta guía?