PITS Blog
  • Home
  • Services
    • Dedicated team Have your own development team at our location in Kerala, India. We tailor our employees individually to your project.
    • Website & web shop Get into the online business and sell your products around the clock. Or convince yourself with a modern website on desktop and mobile devices.
    • Application development We develop very individual web or software applications for you for a wide variety of needs.
    • Hybrid or native iOS & Android Apps Online business is often done on the go today, and the trend is rising. Invest now and make your software mobile-compatible.
  • Credentials
  • Technology
  • Process
  • About us
  • Contact
  • White papers
  • Jobs
  • Blog
  • Startups
�
Priyanka K

WordPress and .NET - WP.NET

By Priyanka K on October, 22 2020
sample post

By Visakh R N

demo post

By Visakh R N

Roadmap to become a DevOps Engineer

By Francis Varghese

Gutenberg - More Than Just An Editor

By Priyanka K

WP.NET is WordPress compiled to .NET Core using PeachPie compiler. This means that the original source code of WordPress, which was written in PHP, has been migrated to the .NET platform, which provides the following benefits:
• Improved performance
• Enhanced security
• Extensibility in C# and other .NET languages
• Extensibility using Razor partial views
• Ease of configuration
• Running natively on Azure
With WP.NET, you get all the amazingness of WordPress, but with the robustness, security and performance of .NET. There are, however, a few key differences compared to regular WordPress:
• Sourceless distribution: you don’t need any PHP sources on your server with WP.NET
• No server-side PHP changes: because WP.NET is compiled PHP code, we do not allow for unsafe practices, such as making changes to the code on the server. If you want to modify the sources, you’ll have to re-compile and re-deploy the project. You’ll thank us later.
• Plugins and themes: due to the previous point, plugins and themes also need to be compiled; therefore, you won’t be able to upload a new theme or download and install plugins like you’re used to from WordPress.

Integrate WordPress as ASP.NET Core Middleware

Prerequisites
You will need to have these on your machine before you get started.
1. Visual Studio 2019 IDE / Visual Studio Code
2. The Latest .NET SDK – Get it here
3. MySQL Server Installed and configured, as WordPress will be using this Server Instance for Persistence.

Step 1 – Setting up the MySQL Database

Make sure that the latest versions of both MySQL Server (Community) and MySQL WorkBench installed. If not, download and install them. With that done, Open up MySQL Workbench. Create a blank database/schema for our WordPress Application to run. The tables will be auto-generated by WordPress as soon as the application launches for the first time.

Step 2 – Setting up ASP.NET Core Project

Open up Visual Studio IDE and create a new ASP.NET Core Web Application. This will act as the Container over which WordPress will be running. Make sure that you have selected ASP.NET Core 3.1+.

Step 3 – Installing the Required Package

Install the specified Package from Nuget. Open up your Package Manager Console and run the following snippet.

       Install-Package PeachPied.WordPress.AspNetCore -Version 5.5.1-preview1

Step 4 – Configuring WordPress

Add the connection details to appsettings.json.
“WordPress”: {
“dbhost”: “localhost”
“dbpassword”: “root”,
“dbuser”: “root”,
“dbname”: “wordpressdb”
}
Then open up Startup.cs/ConfigureServices method and add in the following.

 services.AddWordPress(options =>{});

Next, in the Configure method, add the following.
app.UseWordPress();
Then, build and run the application. We will get the default WordPress Installation Wizard.Then like every wordpress website we need to do the initial settings and start working.

References:

 https://www.codewithmukesh.com/blog/running-wordpress-on-aspnet-core/
 https://www.wpdotnet.com/

We'd love to hear from you.

Contact us

Switzerland
thomas(at)pitsolutions(dot)com
+41 (0) 43 558 4360

India
enquiries(at)pitsolutions(dot)com
+91 (0) 471 270 0615 / 715

UAE
mohammed(at)pitsolutions(dot)com
+971 (0) 4 359 8610

USA
arnab(at)pitsolutions(dot)com
+1 (0) 703 945 8076

Copyright © 2019PIT Solutions AG.An ISO 9001:2015 certified company. All Rights Reserved

SCROLL TO TOP