Asp.net host website on local machine with custom url instead of http://localhost/ in IIS
|
|
Introduction:
In this article I will explain how to create or setup or host new site in IIS with custom URL(http://yoursitename.com) instead of http://localhost/ in asp.net.
In this article I will explain how to create or setup or host new site in IIS with custom URL(http://yoursitename.com) instead of http://localhost/ in asp.net.
Description:
In previous post I explained how to publish or deploy our application in IIS. In one situation I got requirement like setup separate new site in IIS with custom url (ex: http://aspdotnet-suresh.com ) in system not under Default website.
In previous post I explained how to publish or deploy our application in IIS. In one situation I got requirement like setup separate new site in IIS with custom url (ex: http://aspdotnet-suresh.com ) in system not under Default website.
Before setup new site in IIS first
create one sample application in asp.net using visual studio. Once new application
is ready Open Run command and type “inetmgr” and click enter button then
IIS will open if not IIS is not installed in your machine. To install IIS in
your system
START ---> Control Panel ---> Programs ---> Turn Windows
Features on or off ---> Internet Information Services ---> Web Management Tools ---> Check or select IIS
Management Console ---> Click OK
|
|
After that follow below steps to setup
or host new application in your system.
Open RUN Command window and type “inetmgr”
Once opened IIS now select sites ---> Right click on it
and select Add Website
Whenever we select Add Web Site option
new window will open in that we need to enter Site Name, Physical Path and Host
name that would be like this
|
|
If you observe in above image here I given
Host name as aspdotnet-suresh.com after
completion of my setup if I type http://aspdotnet-suresh.com
in my browser automatically it display my custom local setup application
instead of my website. After enter all the details click OK. Now our site add
in IIS that would be like this
|
|
Now our application is ready Right
click on your site ---> Select Manage Web Site ---> Click Browse
|
|
After click Browse our application will
open with our custom url (Here I given as http://aspdotnet-suresh.com
) that would be like this
Why
this error is coming?
We are getting this error because of we
didn’t set host file with this url
To set url in host file you need to
open this path
C:\Windows\System32\drivers\etc
|
In this folder select hosts file and open with notepad (if you’re
using Windows7 open that file like Run as Administrator) and set the url path
will be like this
127.0.0.1 aspdotnet-suresh.com
(Note:
Don’t include # symbol before IP and
url because if you add # it will ignore our site path)
|
|
After set the url path now run your
application that will show output of your application will be like this
|
|
I hope it helps you to set new site in
system with custom url.
Categories: ASP.NET
Post a Comment
Oops!
The words you entered did not match the given text. Please try again.








Oops!
Oops, you forgot something.