你好,我正在尝试将我的angular 4应用程序发布到我的.net服务器上
我做了ng构建,得到了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>
发布于 2018-01-10 16:00:43
基本上你唯一要做的就是
1.-创建新的项目Web API,Core2.0为空2.-更改startup.cs的函数配置,添加UseDefaultFiles和useStaticFiles
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseDefaultFiles();
app.UseStaticFiles();
}
2.-复制wwwroot中的"dist“文件夹
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中查看此链接以获得更完整的答案)
https://stackoverflow.com/questions/48176085
复制相似问题