Skip to content

Step-by-Step Guide to Running NopCommerce on Microsoft Azure

Published: at 08:03 AM

This tutorial provides instructions for setting up and running NopCommerce 3.1 on Microsoft Azure, utilizing Azure Cloud Services and Azure SQL Database.

Prerequisites

  1. Software:

    • Visual Studio 2012
    • SQL Server 2012
  2. NopCommerce Source Code:

Step 1: Local Setup

  1. Extract the NopCommerce source code and open it in Visual Studio 2012.

  2. In Visual Studio:

    • Right-click on Presentation/Nop.Web and set it as the startup project.
    • Press F5 to build and run the project locally.
  3. On the installation page:

    • Provide your email address and create a password for the admin account.
    • Check the Create Sample Data box.
    • Select Use SQL Server and provide database details:
      • SQL Server name: localhost\SQLExpress or equivalent.
      • Database name: e.g., nopDB.
      • SQL Server admin credentials (default: SA with the password you set during installation).
  4. After installation, confirm that NopCommerce runs locally in the browser.

Step 2: Set Up Azure

  1. Create an Azure Account:

  2. Create Azure SQL Database Server:

    • Go to Azure Portal and navigate to SQL Databases.
    • Create a new SQL Database:
      • Choose Web Edition, 1GB.
      • Configure admin credentials and save the server name (e.g., yourserver.database.windows.net).
    • Allow your local machine to access Azure SQL Server:
      • Add your IP address under Configure > Allowed IP Addresses.
  3. Migrate Local Database to Azure:

    • In SQL Server Management Studio (SSMS):
      • Right-click your NopCommerce database and select Tasks > Deploy Database to SQL Azure.
      • Provide Azure SQL Server details and credentials.
      • Complete the migration process.

Step 3: Configure Azure Project in Visual Studio

  1. Add an Azure Cloud Service project to your solution:

    • Right-click the solution > Add > New Project > Visual C# > Cloud > Windows Azure Cloud Service.
    • Name it nopAzure.
  2. Configure settings for Nop.Web:

    • Under Presentation\Nop.Web\References\Microsoft.Web.Infrastructure, set Copy Local to True.
    • Add Nop.Web as a Web Role under nopAzure/Roles.
  3. Publish the project to Azure:

    • Right-click nopAzure > Publish.
    • Sign in to Azure to import credentials.
    • Create a new Cloud Service and storage account.
    • Enable Remote Desktop and Web Deploy for all roles.
    • Complete the publishing process.

Step 4: Finalize Azure Configuration

  1. Use Remote Desktop to access the Azure instance:

    • Go to Cloud Services in the Azure Portal.
    • Select the instance and connect via Remote Desktop using credentials set during publishing.
  2. Configure Settings.txt:

    • Navigate to F:\sitesroot\0\App_Data on the Azure instance.

    • Create Settings.txt with the following content:

      DataProvider: sqlserver
      DataConnectionString: Data Source=tcp:{server name}.database.windows.net,1433;
      Initial Catalog={database name};
      Integrated Security=False;
      Persist Security Info=False;
      User ID={username}@{server name};
      Password={password};
      MultipleActiveResultSets=True
      

Step 5: Access Your Azure-Hosted NopCommerce

Visit {cloud service name}.cloudapp.net to access your NopCommerce site hosted on Azure.

Troubleshooting

References


Previous Post
Test Credit Card Numbers for Payment Processing
Next Post
How to Add Git to the System PATH