4

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?

4

3 回答 3

7

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

于 2014-01-28T13:39:07.803 回答
2

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.

于 2017-05-03T06:42:36.613 回答
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

于 2014-01-28T12:05:04.047 回答