Our blog contains the activity stream of Orchard Dojo: general news, new resources or tutorials are announced here.

Blazor guide for decoupled CMS, Workflow Trimming Task - This week in Orchard (06/09/2024)

Blazor guide for decoupled CMS, a new Workflow Trimming Task, and our renewed Orchard Dojo website are the topics for this week. You can still cast your votes for the Jean-Thierry Kéchichian Community Award! Only one week left until the Orchard Harvest conference! Let's see the news for this week!

Featured tags

IIS
API
All tags >

Media Profiles, Renamed SummaryAdmin shapes - This week in Orchard (16/10/2020)

Media profiles feature to Orchard Core that allows you to defined preset image resizing and formatting commands! Renamed SummaryAdmin shapes, and new routes to avoid features URL blocking by IIS, and a lot more in our current post! Orchard Core updates Prevent disabling or removing administrator role Let's say you set up your Orchard Core site using the admin as the user name and for some reason, you navigate to Security -> Users to disable your own account. The problem here is that in this case, you are the only user with an Administrator role in the system. From now you can't do that, you will get a warning message saying you cannot disable the only administrator. Go back and edit your own user again and try to edit the user name too. This also triggers a new validation error, because you cannot modify the user name of the currently logged-in user. The last thing here is about removing the Administrator role from your user account. You could do that, but if your user is the only user with the Administrator role assigned, you will get a warning message about you cannot remove the Administrator role from the only administrator. Avoid features URL blocking by IIS IIS has some default filters for security like you can't have specific words in the URL. There are a few words used by us too like .sitemap. IIS also blocks any request ending in .resources by default. The list of blocked extensions includes a bunch of other terms that could conceivably be used in feature IDs such as .master, .browser, .config, .skin, etc. It's possible to override this behavior in the web.config file but this would have to be done on a per-application basis and carries unwanted security implications. The solution is just to put these parts in a different segment. If you want to enable a feature the URL to do that was:https://localhost:5501/Admin/Features/Enable/OrchardCore.Sitemaps Now the new URL is:https://localhost:44300/Admin/Features/OrchardCore.Sitemaps/Enable So the goal of this fix is to use the pattern Admin/Features/{id}/Enable in place of Admin/Features/Enable/{id}. The same goes for when you want to disable a feature. Renamed SummaryAdmin shapes of ContentsDriver These shape names are not compatible when defining custom placement, so they have been renamed. They are admin shapes, so the impact is quite low. If you have your own custom theme and redefined these ones you have to change them. So, the ContentsDriver creates four shapes with different shape types. Shape("Contents_SummaryAdmin__Tags", new ContentItemViewModel(model)).Location("SummaryAdmin", "Tags:10"), Shape("Contents_SummaryAdmin__Meta", new ContentItemViewModel(model)).Location("SummaryAdmin", "Meta:20"), Shape("Contents_SummaryAdmin__Button__Edit", new ContentItemViewModel(model)).Location("SummaryAdmin", "Actions:10"), Shape("Contents_SummaryAdmin__Button__Actions", new ContentItemViewModel(model)).Location("SummaryAdmin", "ActionsMenu:10") However, the actual shape type is considered before __ i.e. all the above shapes are resolved to the same shape type Contents_SummaryAdmin. Renamed these shapes as following to apply a unique placement record for each shape. Contents_SummaryAdmin__Tags renamed to ContentsTags_SummaryAdminContents_SummaryAdmin__Meta renamed to ContentsMeta_SummaryAdminContents_SummaryAdmin__Button__Edit renamed to ContentsButtonEdit_SummaryAdminContents_SummaryAdmin__Button__Actions renamed to ContentsButtonActions_SummaryAdmin So that placement will target a single shape type. { "ContentsButtonActions_SummaryAdmin": [ { "shape":"ContentsButtonEditNoView_SummaryAdmin" } ] } Demos New ImageSharp.Web Features ImageSharp is a new, fully-featured, fully managed, cross-platform, 2D graphics library. Designed to simplify image processing, ImageSharp brings you an incredibly powerful yet beautifully simple API. With the v1.0., ImageSharp has got a bunch of new features and it's now a lot faster. And Orchard Core is also using ImageSharp to work with images. New features included: Format support to the Tag Helpers/Liquid Filters: The slight weirdness with adding this is the file extension on the URL will remain .png, but the image will be returned with the correct mime/type. Quality support to jpg encoding and Tag Helpers/Liquid Filters: The Quality support allows you to specify a quality % to jpg encoding. Note: only jpg encoding is supported, but the Format support allows you to convert an image from saying png to jpg, and then reduce the quality. CurrentCulture/InvariantCulture for query string parameters: Supported through custom ImageSharp configuration, but not integrated into Orchard Core. Basing this decision primarily on the idea that most of our resizing/processing query string building, is done through templates, which are culture invariant. And that's not all of it! There is now a new Media profiles feature in Orchard Core that allowing you to specify resizing options and much other stuff. A profile can then be called with the profile name resize_url: profile: 'banner' rather than having to specify all the resizing options that may apply. But that's enough talk for now, let's see them in action, after all, we are in the Demos section of This week in Orchard, right? Use the latest nightly build of Orchard Core and set up your site using the Agency recipe. Then navigate to the admin UI where you will see a new option in the menu (make sure to enable the Media profiles feature): Configuration -> Media -> Media Profiles. Media Profiles are quite simple, they just have the standard resizing options that we have in ImageSharp. Notice that here you can set the width and the height values only from the supported ones. We add the name md to this media profile, let's note it, we will need it right away. Now navigate to Design -> Templates and edit the predefined Content__LandingPage Liquid template. We will use the newly created image profile when displaying the portfolio images. Just a note here: the home page in this agency is a LandingPage content type that has several Bag Parts attached. The one with the display name Portfolio is about to add Project content types to your LandingPage content type. And the Project content type has a Media Field attached, called Image. In this Liquid template, we will use our newly created md media profile. Here we say use the md media profile when displaying these images and in this particular case we would like to override the resize mode for the processed image. Instead of crop, we would like to stretch these images, but just in this case. When you define a media profile, you can say I don't want to specify the width, the height or the resize mode. In that case, you can set them in your Liquid helper, just as you could do that before. Now, let's just check out how does the home page of our site looks like. Remember that we set a lot of values when setting up our md media profile and we also set the quality percentage for the processed image and we set it as 10. We also change the width and height values and override the resize mode to stretch the images. This result is low quality stretched images in the Portfolio section. Now let's see the source code of this page and check out the img tags using the DevTools of Chrome. As you can see it's not tied to ImageSharp, the logic just converts the media profile into a good query string. This means we can do the override easier and if we change the values the URL will change, and it breaks the cache. When you would like to show the kittens.jpg with 100 width and 100 height, by using the crop resize mode (that resizes the image using the same functionality as max then removes any image area falling outside the bounds of its container) and use only 50% as the quality when compressing the image you would write a Liquid filter like this: {{ 'animals/kittens.jpg' | asset_url | resize_url: width:100, height:240, mode:'crop', quality: 50, format:'jpg' }} The documentation is also updated to help you how to use these new arguments. Don't forget to head to YouTube and watch the recording of this awesome feature! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 162 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

Troubleshooting IIS AppPool crashes (status 503) after Windows 10 Anniversary Update

Installing the recently released Anniversary Update (version 1607) of Windows 10 seems to destabilize IIS by shutting down Application Pools, thus resulting in a 503 error when trying to run an application, which is caused by some DLLs failing to load when the worker process starts. Fortunately, the lovely folks of the interwebz are coming to the rescue! First, check out the Windows Event Viewer (Win+X, V) to see what you need to fix: Open "Windows Logs", then "Application" and look for "Error" level entries with the source "IIS-W3SVC-WP" (may be different if the name of your IIS instance is not the default one). In the details, you will see a short message, like this: The Module DLL <path-to-DLL> failed to load. The data is the error. Depending on your configuration, there may be different DLLs causing this kind of problem and they will occur one by one, so you will need to keep checking the Event Logs and fix the issues until your application properly starts up. To be sure, before every attempt, stop IIS and close IIS Manager. Here are two specific issues we've experienced so far and how to fix them, but you may bump into completely different ones: "C:\WINDOWS\system32\inetsrv\rewrite.dll" (reference) Go to "Programs and Features" (Win+X, F) and repair "IIS URL Rewrite Module 2". "C:\WINDOWS\system32\inetsrv\aspnetcore.dll" (reference) Go to "Programs and Features" (Win+X, F) and repair "Microsoft .NET Core 1.0.0 - VS 2015 Tooling ...". Happy updating!

How-to: running Orchard locally through IIS using SQL Server

This tutorial shows you how to run Orchard on your development machine (that doesn't run Windows Server) not with Visual Studio's built-in Cassini webserver, but using a proper IIS webserver. As the database we'll use a standard SQL Server database, that's advised for non-trivial production installations, unlike SQL CE. Update (25th of June, 2016): Added link to a later blogpost about installing SQL Server 2016 and SQL Server Management Studio 2016. The video shows everything in detail, but here are the main points you have to follow, together with corresponding links. First we'll install IIS, corresponding tools and set up our Orchard instance as a website in IIS. Then we'll set up a local SQL Server too. Install WebMatrix, this will install Web Platform Installer as well. You may ask yourself "Why do I need WebMatrix? I'm not a rookie!" However WebMatrix is still a nice lightweight tool for certain tasks, especially for checking the SQL CE database of your experimental Orchard instances your run locally: WM's SQL browser is much more straightforward to use than SQL Server Management Studio for small datasets (what you'll likely have when you develop something and you want to dig around int the DB) and it supports SQL CE out of the box.Also, installing WM will install some dependencies that we'll need anyway, like IIS Express.If you absolutely want to avoid WM you could install Web PI directly, then install the latest IIS Express through Web PI as a minimum. Install IIS Manager (IIS Manager for Remote Administration) from Web PI. IIS Manager will enable us to edit the setup of IIS from a graphical interface. Actually as its name tells, you can use IIS Manager not just to manage your local IIS, but also remote servers (if they enable this). Install the following extensions through Web API: ASP.NET 4.5 or newer if you have it listed in Web PI (needed for running ASP.NET web apps) and IIS Recommended Configuration, HTTP Errors at least, but you'll likely need URL Rewrite too. If you don't have .NET 4.5 or newer already installed (because you run a system older than Windows 8) then you should install that (also possible through Web PI) first. Set up your first Orchard website in IIS by opening IIS Manager and doing the following: Add a new web site from under Sites. Under Physical Path browse the Orchard.Web folder of the instance you want to run with IIS. As the default binding the most simple value you can use is something like "mysite.localhost". This way you can run your sites with a nice url that is only reachable from your machine. Go to Application Pools in IIS Manager. Make sure the app pool you've created runs on the latest .NET framework.Also change the app pool's identity (under its Advanced Settings to your account with your user's credentials. This will come handy when setting up the SQL Server connection where we'll not use an SQL database user/pass combo but the connection will have "integrated security" (i.e. will use our user). If you use DB users then you don't need to change the app pool's identity, just remember to include that user/pass in your site's connection string then. Don't forget to build your solution latest at this point otherwise you'll see "Parser Error: Could not load type 'Orchard.Web.MvcApplication'." messages. At this point you can open up your site and install it with SQL CE just as usual. But we want more! We want full SQL Server! That's why we download SQL Server Express 2012 Advanced Tools (look for SQLEXPRADV_x64_ENU.exe), or if you're from the future, then the 2140 version of the same tool (I don't think SQL will ever die...). This includes everything we need. Update: here is SQL Server 2014 Express SP 1 (again, download SQLEXPRADV_x64_ENU.exe to get everything). Please visit our later blogpost about installing SQL Server 2016 and SQL Server Management Studio 2016. In the setup choose "New SQL Server stand-alone installation" and install SQL Server. You can basically leave everything on the default (you can set up your server as a default or named instance, it doesn't really matter most of the time; if you want to access your SQL server from under "localhost" though, select default). Now you can connect to your local SQL Server and explore it through SQL Server Management Studio that was installed through Advanced Tools. You can connect with your server's name (if you've chosen to give the server a name when installing), using just "localhost" or by using your computer's name. In Sql Server Configuration Manager make sure to enable TCP/IP connections under "SQL Server Network Configuration" (and as prompted, restart the SQL Server service under "SQL Server Services" in the Config Manager). Otherwise Orchard wouldn't be able to connect to the server. Now you can install Orchard backed by a full SQL Server! Orchard will need an existing DB, so create one from SQL Server Management Studio. Then you can use the following connection string at setup: "Data Source=localhost;Initial Catalog=MyDatabase;Integrated Security=True". Notice "Integrated Security": this means the connection won't need a user/pass as it will just use your Windows user's credentials. This is only possible because we've set up the app pool to run as your user in 4/4! Here we only showed how to run Orchard using IIS, but not how to also make Orchard development. But this part is fairly easy: you can always run your site through IIS by opening its url, without even opening Visual Studio. If you change something on the code because of Orchard's dynamic compilation feature you don't even have to hit Build (just remember to save project files too: use Ctrl + Shift + S to save all in VS if you've added a new file to your module for example). Naturally you can also attach the debugger to the IIS process running Orchard, that can be made a matter of a mouse click with the AttachTo extension.