6

I am new to MVC and I just created one MVC4 test project in VS 2010, it runs perectly but the url is http://localhost:60826/ I wanted to change it to http://my.test.site or at least http://my.test.site:60826/

I thought I can achieve that by simply putting an entry in host file which will resolve my.test.site to 127.0.0.1 and then just change the url to http://my.test.site:60826 . However it is not working, Am I missing something?

EDIT: I was able to achieve this by just adding the 'my.test.site' in proxy ignore list under Internet Options-> Connections -> LAN Settings -> Advanced -> Exception list. now I can access http://my.test.site:60826/ from browser. (Just in case if you want VS to launch the page as http://my.test.site:60826/, go to project-properties-web-start URL add your url there).

Now next step is to get rid of this port number(60826), can anyone throw any light on how to run my application as 'http://my.test.site' i.e. with out any port number?

ahsant
  • 873
  • 3
  • 13
  • 23

1 Answers1

3

Are you using IIS or IIS Express? If the latter, you need to modify the IIS Project URL.

  1. Right click your web project
  2. Select Properties
  3. In the Properties window, select the Web tab.
  4. Provide the Project URL: http://localhost:60826/
  5. Provide the Override application root Url: http://my.test.site:60826/
  6. Click Create Virtual Directory (You may need to be running as Administrator) to do this.
  7. Open up: %USERPROFILE%\My Documents\IISExpress\config\applicationhost.config
  8. In the node modify your site to look like the following:

    <site name="SitenameHere" id="11">
        <application path="/" applicationPool="Clr4IntegratedAppPool">
            <virtualDirectory path="/" physicalPath="C:\Users\**usernameHere**\PathToProjectHere" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:60826:localhost" />
        </bindings>
    </site>
    
Andrew
  • 13,934
  • 8
  • 78
  • 93
Michael G
  • 6,452
  • 1
  • 38
  • 59
  • apologeis for my ignorance, how to tell if I am using IIS or IIS Express? btw I can see "Internet Informsation Services (IIS) Manager" in programs and I also check it is version 6.1 but still I am not sure if it is IIS or IIS Express. – ahsant Sep 03 '15 at 01:30
  • open your project properties, and go tot he web tab, see if Servers section has IIS Express, or LOCAL IIS set. – Michael G Sep 03 '15 at 01:33
  • it is "Use Local IIS Web Server" in web tab of project properties. Moreover step 5 above to create virtual directory is failing and I am getting "Unable to create virtual directory. Could not find the server 'http://localhost:60825/' on the local machine. Creating a virtual directory is only supported on the local IIS server" (Note: I am running VS as admin as you mentioned) – ahsant Sep 03 '15 at 01:38