Всем привет! Спасибо за статью и руководство :) Большое спасибо!
У меня возникла проблема, когда я запускаю свою установку. Я реализовал ваш шаблон, а также установил драйверы для EntityFrameworkCore для использования с PostgreSQL.
Теперь, когда я запускаю свое приложение из шаблона, я получаю сообщение от EDBPostgres, что «Сервер запущен и работает», что все хорошо, но я хотел видеть экран HelloWorld VueJS, а не это.
appsettings.json
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*", "ConnectionStrings": { "GymCRMConnectionString" : "Host=x;Port=x;Database=x;Username=x;Password=x" } }
запускSettings.json
{ "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:50598", "sslPort": 0 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "launchUrl": "", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "GymCRM": { "commandName": "Project", "launchBrowser": true, "launchUrl": "weatherforecast", "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } }
Startup.cs
using GymCRM.Data; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using VueCliMiddleware; namespace GymCRM { public class Startup { public IConfiguration Configuration { get; private set; } public Startup(IConfiguration config) { this.Configuration = config; } // This method gets called by the runtime. // Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddSpaStaticFiles(conf => { conf.RootPath = "ClientApp"; }); var DBConnectionString = Configuration["ConnectionStrings:GymCRMConnectionString"]; services.AddDbContextPool<GymCRMContext>(options => options.UseNpgsql(DBConnectionString) ); } // This method gets called by the runtime. // Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IWebHostEnvironment env ) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseSpaStaticFiles(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSpa(spa => { if (env.IsDevelopment()) spa.Options.SourcePath = "ClientApp"; else spa.Options.SourcePath = "dist"; if (env.IsDevelopment()) { spa.UseVueCli(npmScript: "serve"); } }); } } }
Можете ли вы найти ошибку моего пути?