ASP. NET MVC - Self-hosting
Asp.net mvc tutorial
ASP.NET MVC - Self-hosting
In this chapter, we have self-hosting. Self-hosting creates a runtime environment for the application to run in any environment, for example MAC, or on Linux, etc. Self-hosting also means she will have a mini CLR version.
Deploy using file system
Let's take a look at a simple self-hosted example.
Step 1 - Once your ASP.NET MVC application is finished and you want to use selfhosting, right click on the project in Solution Explorer.
You will see the following dialog .
Step 2 - Click on the 'Custom ' option, which will bring up the New Custom Profile dialog box.
Step 3 - Enter the name of the profile e and click on Ok.
Step 4 - Select the file system from the Publish method drop-down list and also specify the target location. Click the "Next " button.
Step 5 - Expand the file publishing options.
Step 6 - Check the "Delete all existing files before publishing " box and Check the "Precompile on publish " boxes and click "Next " to continue.
Step 7 - Click on the 'Publish ' button, it will publish the files to the desired location.
You will see all files and folders in the target location on your system.
It will have all the necessary files to be deployed on the local host.
Step 8 - Now open the Enable or Disable Windows feature and Expand Internet Information Services → World Wide Web Services → Functionalapplication development tees.
Step 9 - Check the boxes as shown in the screenshot above and click on Ok.
Step 10 - Let's open the IIS manager as shown in the following scr eenshot.
Step 11 - You will see different connections on the left side of the screen, right click on MyWebSite.
Step 12 - Select the option 'Convert to Application Option.
As you can see, its physical path is the same as we mentioned above when posting, using the file system.
Step 13 - Click OK to continue.
You can now see that its icon has changed.
Step 14 - Open your browser and specify the following URL http: // localhost "/ MyWeb Site
Youcan see that it is running from the folder we specified during deployment.