- ASP.NET MVC - Self-hosting
- ASP.NET MVC - Deployment
- ASP.NET MVC - Unit Testing
- ASP.NET MVC - Bootstrap
- ASP.NET MVC - Scaffolding
- ASP.NET MVC - Web API
- Nuget Package Management
- ASP.NET MVC - Data Annotations
- ASP.NET MVC - Razor
- ASP.NET MVC - Caching
- ASP.NET MVC - Security
- ASP.NET MVC - Validation
- ASP.NET MVC - Databases
- ASP.NET MVC - Model Binding
- ASP.NET MVC - Helpers
- ASP.NET MVC - Data Model
- ASP.NET MVC - Views
- ASP.NET MVC - Selectors
- ASP.NET MVC - Filters
- ASP.NET MVC - Actions
- ASP.NET MVC - Controllers
- ASP.NET MVC - Routing
- ASP.NET MVC - Life Cycle
- ASP.NET MVC - Getting Started
- ASP.NET MVC - Environment Setup
- ASP.NET MVC - Pattern
- ASP.NET MVC - Overview
- ASP.NET MVC - Home
ASP.NET MVC Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
ASP.NET MVC - Self-hosting
In this chapter, we will cover Self-Hosting. Self-Hosting creates a runtime environment for the apppcation to run in any environment say MAC, or in Linux box, etc. Self-Hosting also means it will have a mini CLR version.
Deploy using File System
Let’s take a look at a simple example of self-hosting.
Step 1 − Once your ASP.NET MVC apppcation is completed and you want to use selfhosting, right-cpck on the Project in the solution explorer.

You will see the following dialog.

Step 2 − Cpck the ‘Custom’ option, which will display the New Custom Profile dialog.

Step 3 − Enter the profile name and cpck Ok.

Step 4 − Select the File System from the Pubpsh method dropdown pst and also specify the target location. Cpck ‘Next’ button.

Step 5 − Expand the File Pubpsh Options.

Step 6 − Check the ‘Delete all existing files prior to pubpsh’ and ‘Precompile during pubpshing’ checkboxes and cpck ‘Next’ to continue.

Step 7 − Cpck ‘Pubpsh’ button, it will pubpsh the files at the desired location.

You will see all the files and folders in the target location on your system.

It will have all the files required to get deployed on the localhost.
Step 8 − Now open the Turn Windows Feature on or off and Expand Internet Information Services → World Wide Web Services → Apppcation Development Features.

Step 9 − Check the checkboxes as shown in the above screenshot and cpck Ok.
Step 10 − Let’s open the IIS Manager as shown in the following screenshot.

Step 11 − You will see different connections on the left side of the screen, right-cpck on MyWebSite.

Step 12 − Select the ‘Convert to Apppcation’ option.

As you can see, its physical path is the same as we have mentioned above while pubpshing, using the File system.
Step 13 − Cpck Ok to continue.

Now you can see that its icon has changed.
Step 14 − Open your browser and specify the following URL http://localhost/MyWebSite

You can see that it is running from the folder which we have specified during deployment.
Advertisements