部署角度应用程序后找不到资产文件夹

时间:2018-07-05 08:31:49

标签: angular

我正在开发一个angular5应用程序,该应用程序可以在本地计算机上正常运行,但是当我在Web服务器上发布该应用程序时,它在控制台中出现错误,提示找不到CSS和JS文件。

下面是我发布应用程序的步骤

1。]运行命令ng build --prod

2。]从dist文件夹复制文件并粘贴到inetpub / wwwroot / myapp /

它不起作用,经过一番搜索之后,我发现了关于stackoverflow的解决方案

3。] ng build --base-href“ / myapp /” --prod

发布成功后,应用程序即可运行,但仍找不到CSS文件

enter image description here

下面是我的index.html

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Svcl</title>
  <base href="/myapp/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="/assets/css/pace-theme-flash.css">
  <link rel="stylesheet" type="text/css" href="/assets/css/custom.css">
  <link rel="stylesheet" type="text/css" href="/assets/css/dev.css">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
  crossorigin="anonymous"></script>
  <link href="/assets/ng2-toastr.min.css" rel="stylesheet" />
<!-- <script src="/assets/ng2-toastr.min.js"></script> -->
  <style type="text/css">
    .carousel-indicators li{
      background: #ccc;
      height: 10px;
      width: 10px;
      border-radius: 50%;
    }
    .pace .pace-activity{width:59px;height:71px;right:50%;top:50%
  }
    .carousel-indicators li.active{
      background: rgb(0, 105, 190)122;
    }
  </style>
  <style>
    .bg-grt{
      background-color: rgb(0, 105, 190)122 !important;
    }
    .btn{
      border-radius: 0px !important;
    }
  </style>
</head>
<body style="background-color: #f5f5f5">
  <app-root></app-root>
  <script type="text/javascript" src="/assets/js/pace.min.js"></script>
  <script type="text/javascript">
    $(document).ready(function(){
      $('.form-group .form-control').focus(function(){
        $(this).parent().addClass('active');
      });
      $('.form-group .form-control').blur(function(){
        // $(this).parent().removeClass('active');

        if( $(this).val().length === 0 ) {
          $(this).parents().removeClass('active');
      }
      });

      $('.form-group .label').click(function(){
        $(this).next().next().focus();
      });
    });
  </script>
</body>
</html>

注意:我在服务器上拍摄了快照,这就是为什么它在其中显示本地主机地址

我如何使其在这里工作?

0 个答案:

没有答案