OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.42k stars 2.39k forks source link

Deployment to IIS on shared host #7719

Open 4m-world opened 3 years ago

4m-world commented 3 years ago

Some lessons learned from deploying an OC project to a shared host that would be great to be included in the deployment docs.

sebastienros commented 3 years ago

Can you comment on each task and the reason for it? I only understand the last point.

4m-world commented 3 years ago
  • Add a web.config to the project if it does not exist in the project Form some reason the web.config was not generated in the publishing process, which was resolved after updating VS to the latest version.

    Set hosting model to outofprocess

The Shared webhost that I'm using has some restrictions with .net core, where OrchardCore did not run using inprocess configuration

turn on the stdoutlog and make sure that to point to accessible/writable path

Some errors that occur during application startup prevent the framework from working. In such cases, enabling the ASP.NET Core stdout log usually helps to diagnose the issue. Which lead me to the previous decision.

change the process form targeting the out .exe' file to targetdotnetand pass the.dll` of your web app as an argument

<aspNetCore processPath="dotnet" arguments=".\CodeMatrix.Oktobly.Web.dll" stdoutLogEnabled="true" stdoutLogFile="..\logs\stdout" hostingModel="outofprocess" />

Frankly, I didn't dig in this point as its the default template with outofprocess, and when I changed the option with the exe file to out of the process the app did not run.

  • since you are on a shared host you will have a warning message about data protection, says it uses memory repository to overwrite it in the application startup make change data protection to a file-based and make sure that the directory has read and write access for the process. More details on data protection can be found here

The default data protection settings are in memory with a shared host we have limitations hence the most appropriate option is to use File System

  • The last thing makes sure that App_Data folder have proper permission (write/ready).