2

I followed the Angular2 VS setup from this page-

https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html

The issue is that http://localhost:56428/ gives a 403 (forbidden) error, and the only way to access my index is to navigate to http://localhost:56428/src/index.html.

This is not ideal, and doesn't even work because requests to system.js and other files on this page go straight to the web root.

I'm not sure if I missed a step here but I don't think this is what they intended. How do I make src/ servable at /?

ANSWER FOUND AT

.net web application change root directory

I don't know why the angular site does not mention that.

micah
  • 7,596
  • 10
  • 49
  • 90

3 Answers3

0

Try to add base tag:

The tag specifies the base URL/target for all relative URLs in a document

.

http://www.w3schools.com/tags/tag_base.asp

kemsky
  • 14,727
  • 3
  • 32
  • 51
0

ANSWER FROM

.net web application change root directory

<configuration>
    <system.web>
        ...
        <urlMappings enabled="true">
             <add url="~/" mappedUrl="~/src/index.html" />
        </urlMappings>
    </system.web>
    ...
    <system.webServer>
        ...
        <rewrite>
          <rules>
            <rule name="Redirect everything to root" stopProcessing="true">
              <match url=".*" />
              <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
              </conditions>
              <action type="Rewrite" url="/src/{R:0}" />
            </rule>
          </rules>
        </rewrite>
    </system.webServer>
    ...
</configuration>
micah
  • 7,596
  • 10
  • 49
  • 90
0

Have you marked your index.html as application start up page?

If not, right click on index.html and click on "Set As Start Page".

Asad Ullah
  • 2,257
  • 2
  • 24
  • 23