You may try this:
<system.webServer>
<rewrite>
<rules>
<rule name="SPA" stopProcessing="true">
<match url=".*" />
<action type="Rewrite" url="/" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile"
negate="true" />
</conditions>
</rule>
</rules>
</rewrite>
</system.webServer>
Mauro Ebert於 2017年1月17日星期二 UTC+8上午2時31分33秒寫道:
>
> Hello everybody,
>
> I'm new to Angular 2 and interested in eventually consider adopting it for
> my company's web development projects, so I decided to have a look at its
> capabilities by following the Tour of Heroes tutorial.
> I have used the instructions provided in Cookbook > VS 2015 QuickStart to
> set up the project and add the quickstart-master files.
>
> Everything worked fine until I had to perform the steps in 6. Routing (as
> warned in the instructions at the end of the project setup).
> After following the steps to add the router outlet and link in the code,
> the tutorial app shows the message hard-coded in index.html ("Loading
> AppComponent content here ..."), instead of the app component html.
>
> In order to solve the issue, I then added a rewrite rule into my
> web.config, which contains the following:
>
> <system.webServer>
> <rewrite>
> <rules>
> <rule name="Angular2" stopProcessing="true">
> <match url=".*" />
> <action type="Rewrite" url="/" />
> </rule>
> </rules>
> </rewrite>
> </system.webServer>
>
> Unfortunately, this apparently doesn't help (has no effect) in getting the
> expected behavior back.
> I'd truly appreciate if someone with (some) more knowledge could shed some
> light on the problem, what I am possibly doing wrong and its actual
> solution.
>
> Thank you in advance!
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.