您好我正在尝试将我的angular 4应用程序发布到我的.net服务器
我做了构建,我得到了dist文件
然后我将我在dist文件中的文件发布到我的ftp根文件夹(httpdocs)
当我发布并打开网站时,我在控制台上收到此错误
/inline.bundle.js Failed to load resource: net::ERR_CONNECTION_RESET
/polyfills.bundle.js Failed to load resource: net::ERR_CONNECTION_RESET
/styles.bundle.js Failed to load resource: net::ERR_CONNECTION_RESET
/scripts.bundle.js Failed to load resource: net::ERR_CONNECTION_RESET
/vendor.bundle.js Failed to load resource: net::ERR_CONNECTION_RESET
/main.bundle.js Failed to load resource: net::ERR_CONNECTION_RESET
我在index.html文件中尝试将基础href从='/'替换为'',但它没有工作
你到底应该怎么想?
我的index.html文件
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ne Nerede ?</title>
<base href="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="oneriyorum.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<link rel="stylesheet" href="node_modules/ladda/dist/ladda.min.css">
<script>
</script>
</head>
<body class="hold-transition login-page">
<app-root></app-root>
<script type="text/javascript" src="inline.bundle.js"></script>
<script type="text/javascript" src="polyfills.bundle.js"></script>
<script type="text/javascript" src="styles.bundle.js"></script>
<script type="text/javascript" src="scripts.bundle.js"></script>
<script type="text/javascript" src="vendor.bundle.js"></script>
<script type="text/javascript" src="main.bundle.js"></script>
</body>
</html>
答案 0 :(得分:0)
基本上你唯一要做的就是
1.创建一个新的项目Web API,Core 2.0为空 2.-更改startup.cs的配置功能,添加UseDefaultFiles和useStaticFiles
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseDefaultFiles();
app.UseStaticFiles();
}
2.-复制你的&#34; dist&#34; wwwroot中的文件夹
3.-您的index.html就像
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyApp</title>
<base href="/">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="styles.e85e86d6d65752737800.bundle.css" rel="stylesheet" />
</head>
<body>
<app-root>Loading..</app-root>
<script type="text/javascript" src="inline.1aea26911fb58219f5a8.bundle.js"></script>
<script type="text/javascript" src="polyfills.ad37cd45a71cb38eee76.bundle.js"></script>
<script type="text/javascript" src="main.d1e85e225566be5f9e29.bundle.js"></script>
</body>
</html>
4.发布您的项目
(您可以在www.codeproject.com中查看此链接以获取更多完整答案)