nopCommerce CMS on ASP.NET MVC: a review of the functionality of the new version

    nopCommerce is an open source online store engine written in ASP.NET MVC. The project is being developed by our compatriots from the city of Yaroslavl, and today more than 20,000 sites are operating on its basis, including brands such as Volvo, Turkish Airlines, Reebok.


    A few days ago, a new version of 3.70 was released, in which developers added full support for Windows Azure. In previous versions, store owners could only use one instance in Azure, but now support for several has been added. Therefore, in essence, this functionality can be used on web farms. This gives us great opportunities to scale the application.

    Suppose you have already downloaded ( http://www.nopcommerce.com/downloads.aspx ) and installed ( http://docs.nopcommerce.com/display/nc/Installing+nopCommerce ) nopCommerce in Azure. So, what has been done to support Azure, and how to configure and enable all of this:

    Blob storage


    Now you can configure the storage of resources (for example, images of products and categories) as blobs, and not just store them on the file system, as is done by default. You can read more about the storage service in Azure here ( https://azure.microsoft.com/en-us/documentation/articles/storage-introduction/ ).

    How to set up in nopCommerce:

    • Of course, you first need to create a storage BLOB account in Windows Azure. This procedure is well described here ( https://azure.microsoft.com/ru-ru/documentation/articles/storage-create-storage-account/ )


    • After that, you can get the connection string, container and endpoint from this repository.
    • Now you need to open the web.config file in nopCommerce. Find the AzureBlobStorage XML element and enter the connection string, container and endpoint previously obtained
    • Once this is done, your resources will be stored in Azure BLOB

    Caching and Distributed Sessions


    Of course, in any distributed application, we need to have support for distributed caching and sessions. Otherwise, different instances of the application will use different data. We chose Redis ( http://redis.io/ ) to implement this functionality, since Azure and many other cloud services already support it.

    How to set up in nopCommerce:

    • First install Redis. How to use Redis in Azure is well written here ( https://azure.microsoft.com/en-us/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/ ).


    • Once the previous step is completed, we need to copy and specify the connection string from Redis in the web.config file in nopCommerce. Find the XML element “RedisCaching”, set the “Enabled” attribute to “True”, and then specify the connection string itself to Redis in the next attribute. Now all cached data is stored in Redis
    • Now do the same for the sessions. Open the web.config file again, uncomment the “sessionState” element and specify in it the same connection string that was used in the previous step


    Background tasks (schedule tasks)


    And the last step. nopCommerce uses background tasks for various activities that must be performed automatically. For example, sending mail or updating exchange rates. Of course, when we have several instances of an application, then such tasks should be performed only on one of them. Otherwise, a situation may occur when the same letter arrives to the buyer twice (from each instance of the application).

    nopCommerce We

    will also open the web.config file. Find the XML element “WebFarms” and set its attribute “MultipleInstancesEnabled” to “True”. This will be enough for a web farm, but on Windows Azure you will need to set the RunOnAzureWebsites attribute to True in the same place.

    That's all. Now nopCommerce is ready for full-fledged work in Azure on several copies (instance). You no longer have to think about whether there is enough server power to serve a large number of customers.

    Also popular now: