在IIS上的虚拟目录下运行Angular8(无法访问内部链接)
这个问题与第8条有关 我有一个在IIS上运行的网站,代码在.Net中,AngularJs 1.6说www.parent.com 我正在用纯Angular 8(单页应用程序)构建一个全新的网站,目前拥有www.parent.com项目的一些页面。我还必须在同一个域上运行它们。因此,我试图在虚拟目录中托管新网站 我尝试的是:在IIS上的虚拟目录下运行Angular8(无法访问内部链接),iis,angular8,virtual-directory,Iis,Angular8,Virtual Directory,这个问题与第8条有关 我有一个在IIS上运行的网站,代码在.Net中,AngularJs 1.6说www.parent.com 我正在用纯Angular 8(单页应用程序)构建一个全新的网站,目前拥有www.parent.com项目的一些页面。我还必须在同一个域上运行它们。因此,我试图在虚拟目录中托管新网站 我尝试的是: 创建了一个虚拟目录,比如说/v2 使用ng build--base href”/v2--deploy url”/v2/“构建Angular8项目,并将dist复制到/v2目录中
ng build--base href”/v2--deploy url”/v2/“
构建Angular8项目,并将dist复制到/v2目录中HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Most likely causes:
The directory or file specified does not exist on the Web server.
The URL contains a typographical error.
A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
Create the content on the Web server.
Review the browser URL.
Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.
Detailed Error Information:
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://parent.com:80/Child/timetable/worker
Physical Path D:\WebSites\Child\timetable\worker
Logon Method Anonymous
Logon User Anonymous
更新:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true" />
<rewrite>
<rules>
<rule name="AngularJS Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/v2" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
是否在IIS中启用url重写扩展?如果您启用了url重写,我建议您可以发布详细信息配置设置供我们测试。我还没有对重写扩展做任何操作,将检查文档。你能给我指一些关于它的教程吗?@BrandoZhang我已经用配置更新了答案