c# – *trying to install and run wordpress from a net core 8.0 project


I created a .net core 8.0 MVC web application in visual studio 2022. I want to use word press to build some of the web pages in the project. I installed the “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": "iqtime",
    "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?

thanks for any advice or suggestions

Leave a Reply

Your email address will not be published. Required fields are marked *