*trying to install and run wordpress from a net core 8.0

iqworks Information Quality Works 331 Reputation points
2024-12-02T22:05:28.7933333+00:00

Hi, 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": "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?
  
Developer technologies Visual Studio Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2024-12-03T07:09:43.4533333+00:00

    Hi @iqworks Information Quality Works, 

    Welcome to Microsoft Q&A! 

    Your issue is more related to WordPress, please report it in dedicated WordPress forum. 

    Thanks for your understanding. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.