6

I have created an MVC4 web application and I want to use my custom domain myApp.com instead of localHost:56605 . so I have added

127.0.0.1:56605  myApp.com

to the hosts file. 2nd: I have gone to project properties in Visual studio 2012 and added myApp.com instead of localhost:56605. but when I click on Create virtual directory I got a warning indicating unable to create a virtual directory. I also edited the applicationHost.config file too. but the problem still remains.

I have also searched in stackoverflow but most rely to this approach myapp:56605. I dont want to insert port number in the url.

how can I accomplish this?

8
  • You'll need to have IIS Express run on port 80 if you don't want to use a port number. The hosts file only affects DNS lookups. Commented Nov 8, 2013 at 17:19
  • could you explain more? Commented Nov 8, 2013 at 17:25
  • 1
    The hosts file only translates myapp.com to 127.0.0.1. The port number (56605) is completely separate. You can remove it from the hosts file and type myapp.com:65605 into your browser if you like. Commented Nov 8, 2013 at 17:47
  • @acfrancis I have done this. but I don't want to have port number in the url. I just want to have a clean URL like: myApp.com/people Commented Nov 8, 2013 at 18:13
  • 1
    This MSDN article seems to have decent walk through about using a different port number. You need to use port 80 (the standard HTTP port) if you don't want to enter any port number in the URL. Also, stackoverflow.com/a/11250513/254973 has some instructions on how to get a different domain up and running (though it seems like you've got that up and running?) Commented Nov 8, 2013 at 20:21

3 Answers 3

9

so what I did to fix this issue:

in the hosts file I added:

127.0.0.1 myApp.com

then in the applicationhost.config which is located in IISExpress in my document I edited binding section of my app like this:

<binding protocol="http" bindingInformation="*:80:myApp.com" />
<binding protocol="https" bindingInformation="*:443:myApp.com" />

then go to project properties in visual studio and in the web tab edite project url like this:

http://myapp.com

then click on create virtual directory, your virtual directory will created successfully. then your site using port 80. which shouldn't used by any other app in your pc. else you get an error indicating your port 80 is used by another process.

to fix this issue close skype, teamViewer, and in IIS manager all of the site you have created and using port 80 should be stopped.

finally you can successfully surf your site www.myApp.com more explanation:

http://www.macaw.nl/weblog/2013/6/configuring-an-asp-net-project-for-development-with-ssl http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

Sign up to request clarification or add additional context in comments.

Comments

4

I found a faster way. Change the applicationhost.config where you put localhost over ip directly (127.0.0.1).

<binding protocol="http" bindingInformation="*:55449:127.0.0.1" />

In the file hosts in system32 add the name of the domain:

127.0.0.1 domainname.com

So you can access by name your application running on iis express.

1 Comment

Adding binding for the loopback ip worked for me. Many thanks :-)
1

but when I click on Create virtual directory I got a warning indicating unable to create a virtual directory

-> this can be fixed if you run visual studio as an administrator

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.