Angular 角度4 403禁止与IIS一起使用路由参数

Angular 角度4 403禁止与IIS一起使用路由参数,angular,angular-ui-router,iis-6,Angular,Angular Ui Router,Iis 6,我使用IIS版本6.1 SP1将Angular项目部署到我们的开发环境中,我的route参数出现403禁止的错误。在我的URL中,“客户端”不是一个组件,而是一个路由参数。这个项目在我的本地主机上运行得非常好,问题只是当我将代码推送到我们的开发环境时 以下是我在app.routes.ts中的代码: const routes: Routes = [ { path: '', redirectTo: 'login', pathMatch: 'full' },

我使用IIS版本6.1 SP1将Angular项目部署到我们的开发环境中,我的route参数出现403禁止的错误。在我的URL中,“客户端”不是一个组件,而是一个路由参数。这个项目在我的本地主机上运行得非常好,问题只是当我将代码推送到我们的开发环境时

以下是我在app.routes.ts中的代码:

const routes: Routes = [
   {
       path: '',
       redirectTo: 'login',
    pathMatch: 'full'
},
{
    path: 'login',
    component: LoginComponent
},
{
    path: 'login/:licenseeCode',
    component: LoginComponent

},
...

如果部署到文件夹(而不是根目录),则可能需要调整

<base href="/FOLDER_WHERE_YOU_DEPLOYED/" />

还可以尝试将其添加到配置文件中:

<system.webServer>
    <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="/FOLDER_WHERE_YOU_DEPLOYED/" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

如果部署到文件夹(而不是根目录),则可能需要调整

<base href="/FOLDER_WHERE_YOU_DEPLOYED/" />

还可以尝试将其添加到配置文件中:

<system.webServer>
    <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="/FOLDER_WHERE_YOU_DEPLOYED/" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>


我认为角度布线信息不足以告诉您问题所在。看起来不错;您甚至没有任何可能阻止人们查看组件的防护装置。如果本地环境和生产环境之间存在差异,那么这显然是应用程序之外的问题。我认为角度路由信息不足以告诉您问题所在。看起来不错;您甚至没有任何可能阻止人们查看组件的防护装置。如果本地环境和生产环境之间存在差异,那么这显然是应用程序之外的东西。这正是我刚刚发现的。当我构建项目时,我必须添加--base href/LPPortal2/并相应地修改重写。谢谢这正是我刚刚发现的。当我构建项目时,我必须添加--base href/LPPortal2/并相应地修改重写。谢谢