In this tutorial, we are going to Host ASP NET MVC on Windows with IIS. IIS or Internet Information Services are used to host ASP.Net Web applications to either show your development progress for a client or for a test run of your websites. If you are a freelancer and want to show your sites to your customer, IIS might be your best and easiest way.
For beginners like me, I write this article to share how to host ASP.Net MVC Application in windows with IIS.
Also visit : how to enable IIS How to enable Internet Information Services
Host ASP.Net on windows:
I. Go to the IIS site’s root folder and create a new folder.
- First, open your IIS Manager by going to the start menu and typing “IIS” and select Internet Information Services from the search result. Refer to the image shown below.
You may also use Run then input inetmgr to open IIS Manager.
2. In your IIS manager, expand the sites folder and right click on Default Web Sites. Then select Explore to open the root directory.
3. wwwroot directory appears to create a folder inside the directory. This is where we publish our Websites. In my case, I name it MySites.
II. Publish ASP.NET Website
My Site Preview:
- Open your project in Visual Studio and go to solution explorer. Right-click on your project name and select publish.
2. In the Publish Web Window choose Profile and then create new profile name for your publish profile.
- To customize the profile name for this setting you may set a familiar name to easily identify it for the next time you deploy this application. Enter your desired publish profile name. Then press “OK”.
4. Click “Next” to proceed. Select File System as your publish method.
5. Select your published directory. In my case, it is C:\inetpub\wwwroot\MySites, which is the default website directory of IIS. Then click “Open.”
6. Lastly click on the publish button to proceed. See the image below.
7. It may take a while to finish an application to publish. Once, done you can see the notification from the Output windows like the screenshot shown below.
III. Convert your website to IIS Application
- Go to your IIS Manager and navigate to Sites » Default Web Sites. Then search for your folder name where we published our websites. In my case, I name it MySites. Right-click on the folder name MySites and select Convert to Application.
You’re done!! To open your website application right click on MySites. Select Manage Application then choose browse.
This will open your website in a browser. See the image shown below.
You may also access your websites using your local IP ex. http://192.168.1.2/MySites
That’s it you have successfully publish your website into IIS. You can share your website from your local network. Hopefully, this article will give you an idea and can be used with your future project.
Also Read :