Site hosting news, tutorials, tips, How Tos and more

Deploying an ASP.NET Core 2.0 (Orchard Core) Site on Winhost

The great thing about ASP.NET Core is that it’s portable, allowing you to run your Core application on any OWIN-compatible server. So, even if a particular version of .NET Core is not installed on the server, you can still deploy your Core app in “self-contained” mode.

In this example, we’re going to use the Orchard Core application. Orchard Core is a re-write of the original Orchard application (the thing that runs all the MSDN blogs) in ASP.NET Core. As of the time of this writing, Orchard Core is using ASP.NET Core 2.0. And, at the time of this writing, we have not yet updated our servers with the newest .NET Core to support ASP.NET Core 2.0 natively, but, to repeat: you can still deploy your Core app in “self-contained” mode.

First, some house-keeping. Make sure you have the .NET Core 2.0 SDK installed and Visual Studio is updated.

Orchard Core supports different databases, SQL, SQLite, MySQL and Postgres. I’m going to use SQL, which is included with all Winhost plans. This is a good time to create the SQL database in your Winhost control panel.

Onto the instructions:

  1. Download the Master Branch of Orchard Core from GitHub.
  2. Unzip the file and open the OrchardCore.sln solution file in Visual Studio 2017.
  3. Wait for Visual Studio to restore all the Nuget packages.
  4. Set OrchardCore.Cms.Web as the startup project (right-click OrchardCore.Cms.Web and select “Set as Startup Project”)

  1. Open the OrchardCore.Cms.Web.csproj project file (right-click OrchardCore.Cms.Web and select “Edit OrcOrchardCore.Cms.Web.csproj”)

By default, Orchard Core is Framework-dependent. We have to change that to make it self-contained. We have to specify the target platform (tell the application what kind of server it’s going to be running on). In my case, my Winhost site is running on Windows 2012/IIS 8. You can find this information in your Winhost control panel, under the Site Info section. The Runtime Identifier for Windows 2012/IIS 8 is: win8-x64.  If you’re site is running on a different server, you can check out the full catalog of Runtime Identifiers here.

  1. In the PropertyGroup section, add:
    <RuntimeIdentifier>win8-x64</RuntimeIdentifier>

  1. Save your changes.

Now we’re just about ready to publish.  This would be a good time to remove the parts of Orchard Core that you’re not going to use. (For this example site, I didn’t remove anything.)

Before, pre-2.0, we would have run the dotnet restore and dotnet build commands at this point. But now, those are implicit commands with publish. So you can just run the publish command (right-click OrchardCore.Cms.Web and select “Publish…”). I used FTP to publish the project directly onto the Winhost servers. Instructions for different deployment methods are available here.

Wait for the project to publish, then navigate to your site and you should see the Orchard Core setup page:

I picked the Agency Recipe. Fill out all the fields, click the Finish Setup button and you should see your new site:


4 Responses
  • Vishnu Tripathi Reply

    Hi

    I am not able to run orchard core from IIS.
    I am getting orchard setting page. But when i enter settings and click on “Finish Setup”, I am getting error “Server refused to connect”.

    Please guide me

    Thanks

  • Vishnu Tripathi Reply

    I found solution. wwwroot folder was missing when I published application. I added folder manually in publish folder. That’s it.

    • Curtis Reply

      Awesome. Glad you got it to work.

  • WinFxGuy Reply

    Is ASP.NET Core 3.1 supported for deployment?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.