Я создал веб-приложение MVC .net core 8.0 в Visual Studio 2022. Я хочу использовать Word Press для создания некоторых веб-страниц в проекте. Я установил «PeachPied.WordPress.AspNetCore (6.5.4-rc020)».
The problem is that in the videos I find, I only see them adding code to the Startup.cs, but core 8.0 only has a Program.cs.
I saw a video where it demonstrated how to create a Startup.cs to my core 8.0 project, but it shows it using this “ConfigureServices(IServiceCollection services” method which never gets called when I run the application, even in debug.:
public void ConfigureServices(IServiceCollection services)
{
services.AddWordPress(options =>
{
options.DbHost = "localhost";
options.DbName = "iq-wp";
options.DbUser = "root";
options.DbPassword = "rootpw";
});
also tried using the appsettings.json like this:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"WordPress": {
"dbhost": "localhost",
"dbpassword": "rootpw",
"dbuser": "root",
"dbname": "iq_mspworks_wordpress_db"
}
}
With both,, I get the error:
“Error establishing a database connection”.
Not quite sure what I need to do?
Я создал веб-приложение MVC .net core 8.0 в Visual Studio 2022. Я хочу использовать Word Press для создания некоторых веб-страниц в проекте. Я установил «PeachPied.WordPress.AspNetCore (6.5.4-rc020)». [code] The problem is that in the videos I find, I only see them adding code to the Startup.cs, but core 8.0 only has a Program.cs.
I saw a video where it demonstrated how to create a Startup.cs to my core 8.0 project, but it shows it using this “ConfigureServices(IServiceCollection services” method which never gets called when I run the application, even in debug.: public void ConfigureServices(IServiceCollection services) { services.AddWordPress(options => { options.DbHost = "localhost"; options.DbName = "iq-wp"; options.DbUser = "root"; options.DbPassword = "rootpw";
});
also tried using the appsettings.json like this: { "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*", "WordPress": { "dbhost": "localhost", "dbpassword": "rootpw", "dbuser": "root", "dbname": "iq_mspworks_wordpress_db" } }
With both,, I get the error: “Error establishing a database connection”. Not quite sure what I need to do? [/code] спасибо за любые советы и предложения