224 views
asked in Asp.Net Core MVC by
How to Publish and Deploy ASP.net Core MVC Application in Windows IIS

1 Answer

answered by

inchirags@gmail.com  Chirag's Asp.Net MVC Core Tutorial https://www.chirags.in

*********************************************************************************************

How to Publish and Deploy ASP.net Core MVC Application in Windows IIS

*********************************************************************************************

YouTube Video:

Tutorial Link:

Here’s a step-by-step guide to publish and deploy an ASP.NET Core MVC application in IIS:

1. Prepare Your Environment

Install IIS:

Go to Control Panel > Programs > Turn Windows features on or off.

Select Internet Information Services (IIS) and ensure Web Management Tools and World Wide Web Services are checked.

Click OK to install.

Install .NET Hosting Bundle:

Download the latest ASP.NET Core Hosting Bundle or the appropriate version of the .NET framework for your application from the Microsoft website.

https://dotnet.microsoft.com/en-us/download/dotnet/9.0
https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-9.0.100-windows-x64-installer

https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-9.0.0-windows-x64-installer

https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-9.0.0-windows-hosting-bundle-installer

https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-9.0.0-windows-x64-installer

After install in Control Panel it will looks like below image:

Install it on the IIS server.

Check IIS Configuration:

Open IIS Manager (run inetmgr).

Ensure Application Pools have the required .NET CLR version for your app.

2. Publish the ASP.NET Core MVC Application

Open Your Project in Visual Studio:

Go to Build > Publish {YourAppName}.

Configure Publish Settings:

Choose Folder as the publish target.

Set a publish folder (e.g., C:\inetpub\wwwroot\YourApp) or (You can choose your path.).

Configure other settings like release mode (preferably Release) and click Finish.

Publish the Application:

Click Publish. The application files will be generated in the specified folder.

3. Configure IIS

Create a New Application Pool:

Open IIS Manager.

Under Application Pools, click Add Application Pool.

Name it (e.g., YourAppPool), set the .NET CLR version, and click OK.

Add a Website:

Right-click Sites in IIS Manager and select Add Website.

Enter:

Site name: YourApp

Physical path: The folder where you published the app (e.g., C:\inetpub\wwwroot\YourApp).

Binding: Set the hostname, IP, and port (default: 80).

Assign the new site to the Application Pool created earlier.

Click OK.

4. Configure Permissions

Set Folder Permissions:

Right-click the published folder (C:\inetpub\wwwroot\YourApp), select Properties.

Go to the Security tab, and ensure IIS_IUSRS has read and execute permissions.

Enable Static Content (if needed):

Go to Control Panel > Programs > Turn Windows features on or off.

Under IIS > World Wide Web Services > Common HTTP Features, ensure Static Content is enabled.

5. Database Configuration in appsettings.json

"ConnectionStrings": {
    "DefaultConnection": "Data Source=localhost;Initial Catalog=CrudCoreDb;Integrated Security=False;TrustServerCertificate=True;User ID=sa;Password=admin@123"
  },

6. Test the Application

Restart IIS:

Run iisreset in the command prompt.

Access the Website:

Open a browser and navigate to http://localhost or the hostname/IP you configured.

7. Troubleshooting and Fine-Tuning

Enable Detailed Errors:

Go to the site in IIS Manager.

Select Error Pages, then Edit Feature Settings, and enable Detailed Errors.

Enable HTTPS (optional):

Bind an SSL certificate in Bindings for secure access.

Check Logs:

Check the Event Viewer or IIS logs (%SystemDrive%\inetpub\logs\LogFiles) for errors.

Firewall Settings:

Ensure the server firewall allows traffic on the application’s port (e.g., 80 for HTTP or 443 for HTTPS).

With these steps, your ASP.NET MVC application should be successfully deployed in IIS and accessible.

For any doubts and query, please write on YouTube video comments section.

Note : Flow the Process shown in video.

Please, Subscribe and like for more videos:

https://www.youtube.com/@chiragstutorial

Don't forget to, Follow, Like, Share &, Comment

Thanks & Regards,

Chitt Ranjan Mahto "Chirag"

_____________________________________________________________________

Note: All scripts used in this demo will be available in our website.

Link will be available in description.

#chirags 

#chiragstutorial 

chirags, chirags tutorial, chirags Asp.Net MVC tutorial 

Most popular tags

laravel postgresql laravel-10 replication ha postgresql mongodb laravel-11 mongodb database mongodb tutorial ubuntu 24.04 lts streaming-replication mysql database laravel postgresql backup laravel login register logout database mysql php laravel 11 - login with otp valid for 10 minutes. user and admin registration user and admin login multiauth technlogy asp.net asp.net c# mysql master slave replication centos linux laravel sql server schedule backup autobackup postgresql django python haproxy load balancer install self sign ssl laravel 11 gaurds zabbix 7 how to install graylog on ubuntu 24.04 lts | step-by-step asp.net core mvc .net mvc network upload c# ssl integration sql server on ubuntu 22.04 lts mssql server ms sql server sql server user access in postgres mysql password change cent os linux configure replica laravel 11 socialite login with google account google login kubernetes (k8s) install nginx load balancer install install and configure .net 8.0 in ubuntu 24.04 lts php in iis php with iis php tutorial chirags php tutorials chirags php tutorial chirags tutorial laravel 11 guards mongodb sharding metabase business analytics metabase postgresql 16 to postgresql 17 postgresql migration letsencrypt mongodb crud rocky linux laravel custom captcha laravel 11 captcha laravel captcha mongo dll php.ini debian 12 nginx apache nextcloud gitea in ubuntu git gitea npm error node js mysql ndb cluster mysql cluster ssl oracle login register logout in python debian windows shell batch file bat file time stamp date time shopping cart in laravel centos rhel swap memeory rhel 5.5
...