You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求部署ASP.NET Core 2.0 + Angular 5至A2 Hosting Windows共享主机的分步指南

Got it, here's a tailored step-by-step deployment guide for your ASP.NET Core + Angular admin app on A2 Hosting's Windows shared hosting—all actionable steps right here, no external links needed:

ASP.NET Core + Angular Deployment to A2 Hosting Windows Shared Hosting

1. Prepare Your ASP.NET Core Backend for Local Publishing

  • Open your ASP.NET Core project in Visual Studio (or your preferred IDE).
  • Right-click the project → Select Publish, then choose the Folder target. Set a local output path (e.g., C:\Published\AdminAppBackend) and ensure the build configuration is set to Release.
  • Once published, verify the output folder contains core files: your app’s .dll, web.config, wwwroot directory, and any dependent libraries.
  • Tweak the web.config for A2’s environment: Ensure the aspNetCore node uses InProcess hosting (A2 supports this for better performance) and disables unnecessary logging:
    <aspNetCore processPath="dotnet" arguments=".\YourAdminApp.dll" stdoutLogEnabled="false" hostingModel="InProcess" />
    

2. Package Your Angular Frontend for Production

  • Open a command line in your Angular project’s root directory.
  • Run the production build command:
    ng build --configuration production
    
    This generates a dist/your-angular-app folder with minified, production-ready frontend files.
  • Copy all files from the dist folder into the wwwroot directory of your published ASP.NET Core backend. This lets your backend serve the frontend static files directly, simplifying deployment.

3. Upload Your Combined App to A2 Hosting

  • Log into your A2 Hosting cPanel dashboard.
  • Use either the File Manager tool or an FTP client (like FileZilla) to connect to your Windows shared host.
  • Create a dedicated subdirectory for your admin app (e.g., /public_html/admin-app) to keep it isolated from other site content.
  • Upload every file and folder from your published ASP.NET Core directory (including the updated wwwroot with Angular files) to this new subdirectory.

4. Configure A2 Hosting Environment Settings

  • In cPanel, locate the ASP.NET Core Settings tool (or labeled .NET Core Management depending on your cPanel theme).
  • Select the subdirectory where you uploaded your app, then set the .NET Core Version to match the version you used to publish your backend (e.g., .NET 6.0 or .NET 7.0).
  • Navigate to Application Pools in cPanel: Assign your app to an application pool with Integrated Pipeline Mode and ensure the .NET version matches your app. Leave 32-bit applications disabled unless your app specifically requires it.
  • Double-check file permissions: Right-click your app’s directory in File Manager → Change Permissions. Set permissions to 755 for folders and 644 for files (A2 typically auto-configures this, but it’s good to verify).

5. Test Your Deployed App

  • Navigate to your app’s URL (e.g., https://your-domain.com/admin-app) in a browser.
  • Verify the Angular frontend loads correctly, and test backend API calls to ensure connectivity.
  • If you encounter SPA routing 404 errors, confirm your ASP.NET Core Program.cs (or Startup.cs for older versions) includes the SPA fallback route:
    app.MapFallbackToFile("index.html");
    
    This ensures all frontend route requests are directed to Angular’s index.html instead of returning a 404.

内容的提问来源于stack exchange,提问作者Rizwan Ali Sabir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 06:51:47