2017-02-11 112 views
2

我跟着从这个Angular2 VS设置页面 -角2 Visual Studio安装问题

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

的问题是,http://localhost:56428/给出了一个403(禁止)错误,并访问我的索引是唯一的出路导航到http://localhost:56428/src/index.html

这并不理想,甚至不起作用,因为请求system.js和此页面上的其他文件直接进入Web根目录。

我不确定我是否错过了这里的一步,但我不认为这是他们的意图。如何使src//处可用?

ANSWER FOUND AT

.net web application change root directory

我不知道为什么角部位没有提到。

回答

0

回答

.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> 
0

您标记您的index.html作为应用程序的启动页面?

如果没有,请右键单击index.html并单击“设为起始页”。

+0

我做到了。它转到浏览器中的src/index.html –