2017-02-11 113 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 –