Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Asp.net host website on local machine with custom url instead of http://localhost/ in IIS

Apr 21, 2012
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.


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.

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.

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

41 comments :

sami said...

Thanks.....

Anonymous said...

Hi
Suresh Nice Articals really appriciated but you can make any other tutorials on Application Pools on IIS as well.

karthick said...

thanks to your valuable articles. by karthick

Unknown said...

Would like to add one more point apart from the settings you mentioned above. I followed your steps, but after doing all that, I got 500.19 error.
For this, while setting the site, you have to check the passthrough authentication and set the admin credentials. Also, in the web.config file, inside the system.web section, change the default identity impersonate="false" to identiy impersonate="true" username="*****" password="****"

Anonymous said...

THANKS A LOT...

uyir said...

hi suresh , i have xp , and iis 5.1 , is thaere a way to create new wesite in iis 5.1

Anonymous said...

User login website if whether not signout and same user login website alert already signed
if is possible......

Unknown said...

Ver nice article.. Keep on posting new articles

Avinash Verma said...

i am not able to save hosts file as i m using windows8 pls help.

Anonymous said...

xcv

Unknown said...

Hello suresh i am getting following Error..
Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

Source Error:


Line 24:
Line 25:
Line 26:
Line 27:
Line 28:

Unknown said...

hi suresh its very useful tool for me brother can you guide me how can i make installable database software which can run on loacal machine.

kuldeep

Anonymous said...

Hey Suresh Keep it up with the good posts..

ThereVGo said...

hello sir Please tell me how can i encode complete url of any website into database and reterive from database.

Anonymous said...

good one thanks Suresh...

N Jegan said...

Nice one... Thanks for the valuable article

Anonymous said...

Thanks Suresh,Really it is very helpful.

Unknown said...

Thanks Yashwant Yadav

Jacob said...

It shows an error when i'm setting physical path in "Add website". It shows "cannot verify access to the path." Can anyboby to help me to solve this??? Thanx in advance.

Anonymous said...

Hi suresh,
very nice article,
i have one doubt.after deploying application on server and we need to host on internet domain after
hosting it is available to all internet users.
but my question is .
if user request for that application ,how the request will propagated (i mean flow of request) and how response comes back

Anonymous said...

Hi Suresh ,

Would u help me telling how can i install e commerce website on godaddy server from ms webmatrix.

I have username,servername from godaddy but could not connect to server.

Unknown said...

hi,
Its not working in godaddy server. Can u plz suggest me for this.
Its giving error:
"The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."

Anonymous said...

hi i got it till the part for opening hosts with note pad but i get a message that the host is already running.....what can i do...

Anonymous said...

Hello sir i'm kohila.
I can not access the way.
Because, i use the windows xp.
In that i can not follow to got it sir.
Please help me and give idea to work these in windows xp.
Thank you.

Anonymous said...

Its work ,Thank You So much

Bajid Khan said...

Great .......... Easy way Explnation

Anonymous said...

Cool

Narendran Namachivayam said...

Hi Sir,

Really helpful for very timely needed article.

Narendran N
n4narendran.blogspot.in

Anonymous said...

file upload control and login working on local machine but not in iis on server asp.net vb

Unknown said...

sir im using windown 7.. not working properly.. please help me

Bhavik said...

How to create web hosting website any idea..

Unknown said...

hello suresh i am getting error after run
HTTP Error 500.21 - Internal Server Error
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

Unknown said...

how to get physical path(c:/inetpub/wwwroot....) in wcf service

Unknown said...

thanks dear

Excelanto Global Services said...
This comment has been removed by a blog administrator.
ibrar tariq said...

anyone can tell me how to asp.net c# website run inside the hosting account domain.
i have few days to learn asp.net c#.
i have much more search about this.
but did not solve my problem.

Anonymous said...

Hi suresh nice job. I am getting error after run

This page can’t be displayed.

Please help me .



•Make sure the web address http://own-facebook.com is correct.
•Look for the page with your search engine.
•Refresh the page in a few minutes.

Fix connection problems

Unknown said...

hi suresh... it was really helpful.. but it also displays my port no whatever i have specified while creating the website.. Help me out..

Unknown said...

Hi suresh..Im getting access denied error while updating hosts(i.e adding 127.0.0.1 xxx.com) plz help me out..

Anonymous said...

Hi Suresh,
i follow the same steps. but i am getting the following error.


Network Error (dns_unresolved_hostname)


Your requested host "samplewebform.com" could not be resolved by DNS.


For assistance, contact your network support team.

Anonymous said...

Hi Suresh Sir, with above solution my web application doesn't show the any results. Plz help. Problem is where i found the host file in the system 64

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.