Deploy at angular with IIS server

Asked

Viewed 653 times

1

Hello, I published an angular application on an IIS server, and when trying to access the URL defined on the server I get the following error:

Error shown: "Cannot match any Routes. URL Segment: 'Testdrive'"

inserir a descrição da imagem aqui

I don’t know what to do, I looked on the internet and saw something about routes. Down here I left the codes of my routes..

Route codes

import { Routes } from '@angular/router'
import { Personal, Dealers, Agendamento, Finalizados } from '../2 - WebSite/1 - Formulario';
import { BaseNumerica } from '../1 - Shared';

export const routes: Routes = [
    {path: '', component: BaseNumerica, children: 
        [
            {path: '', pathMatch: 'full', redirectTo: 'dados-pessoais'},
            {path: 'dados-pessoais', component: Personal, },
            {path: 'dealers', component: Dealers},
            {path: 'agendamento', component: Agendamento}
        ]
    },
    {path: 'finalizado', component: Finalizados}
];

Call for routes in the module

imports: [
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    HttpModule,
    RouterModule.forRoot(routes),
    NgxMaskModule.forRoot()
  ],

Thank you in advance...


The first screen to be called is 'personal data' and you do not need to define the URL, in principle

From there, I call the other Urls, that way

this.router.navigate(['dealers'']);

  • As my IIS is local, the URL provided by it was: 'localhost/testedrive'

  • Please enter the link that uses these routes, and how is the <routoutlet>?

  • William, take a look at my little study project, maybe something that can help you: https://stackblitz.com/edit/me-project_angular-6-iuwsch

  • @Marconi, of course, I will insert my code in the question and I will read a read on your project! I appreciate the help, I need to upload this application even today rsrs

  • In it I have some routes configured, see that in the file app.component.ts there’s a tag that calls <router-outlet>, this tag is responsible for displaying the page you triggered through a link.

  • I discovered the rs problem. In the tag, <base> of index.html, the name of the files folder was missing.

  • Post the answer for us to see William!

  • Sure @Marconi, I’ll post below

Show 3 more comments

1 answer

0


It was missing to implement the folder name of the repository of the files, IE, the folder where the files are, tag getting like this:

<base href="/TestDrive">

<head>
    <meta charset="utf-8">
    <title>Test Drive | Volkswagen</title>
    <base href="/TestDrive">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
    <link rel="icon" type="image/x-icon" href="TestDrive/assets/img/Icones/volkswagen.ico">
    <link href="TestDrive/styles.3d09bccc9fc7ffe4913a.bundle.css" rel="stylesheet"/>
</head>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.