Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using custom domain instead of localhost:* in IIS express

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?

like image 985
Hashem Aboonajmi Avatar asked Dec 25 '22 18:12

Hashem Aboonajmi


2 Answers

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

like image 135
Hashem Aboonajmi Avatar answered Dec 28 '22 10:12

Hashem Aboonajmi


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.

like image 39
janmbaco Avatar answered Dec 28 '22 08:12

janmbaco