[tutorial] Step by Step guide on how to get nopCommerce 3.1 to run on Microsoft Azure Cloud Service and Azure DB

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 10 ans
a better formatted doc at http://www.swimincode.com/

1. I am assuming you already have Visual Studio 2012 and SQL Server 2012 installed
2.  Grab nopCommerce 3.1 source code from https://www.nopcommerce.com/downloads.aspx.
  * Extract it to a folder and load it up in Visual Studio 2012 (note you can't use Visual Studio
  2013 Preview since Azure is not supported yet)
  * Right click on Presentation/Nop.Web and set as startup project
  * Press f5 to run it for the first time
3.  nopCommerce installation page should come up
  *  Use your email address and think of a password for admin user account
  *  Check create sample data box
  *  Select 'Use SQL Server' database
  *  Check create database if it doesn’t exist
  *  Type your SQL 2012 Server name
  *  Type a database name to be used by nopCommerce such as nopDB
  *  SQL Username is SA for admin by default for SQL server 2012, type in the password you made up for SQL admin when you installed SQL Server
  *  Click install, the shop should showin your browser if everything is setup correct, so now you got nopCommerce installed locally
4.  Now you need to setup Windows Azure account. Go to http://www.windowsazure.com/en-us/ and get your free trial with 200$ credit.
5.  After registering and setting up your Azure, we need to first create an azure database server.  
  *  go to https://manage.windowsazure.com, your Azure control panel.
  *  Click on SQL databases on the left.
  *  Put a name for your SQL database, it doesn’t really matter since you will be deleting it soon.
  *  Choose WEB edition.
  *  1GB
  *  Choose New SQL database server
  *  On next page, put in a admin login name for your azure database server
  *  Put in a password
  *  Pick a region closest to where you want to host it (very important for speed)
  *  After the azure database server is created, write down your azure database server name (such as plpzhwxv1m)
  *  Go to your azure database server settings by clicking on the azure database server name
  *  Go to configure tab on the top and add your current ip to the allowed ip address and click on save. This step is very important to let your local machine establish contact with azure database server.
  *  Now go back to sql databases screen and you may click on the databases tab and delete the database, make sure you don't delete the database server, only the database since it's not going to be used.  
6.  Next we are going to migrate the local nopCommerce database from your SQL Server 2012 to Azure.
  *  Go to SQL Server management studio and log in your SA account.
  *  Right click on the database you created for nopCommerce, choose Tasks and then select deploy database to SQL Azure.
  *  Under Server connection click on connect button, under server name type your azure sql server name + .database.windows.net,1433 (such as plpzhwxv1m.database.windows.net,1433)
  *  Next to Login and Password put down your azure db server login and password you made up in step 5 earlier
  *  Click on connect and put down a new azure database name, then hit finish and you should be done with the database migration. The same steps could be used to migrate existing nop database instead of the sample nop database.
7.  Now lets go back to Visual Studio and add a new Azure project so we can deploy it to the Azure cloud. Right click on Solution and add Visual C#/Cloud/Windows Azure Cloud Service and name it nopAzure.
  *  Under .Net Framework 4.5 roles don't have to select anything.
  *  Go to Presentation\Nop.Web\References\Microsoft.Web.Infrastructure and under properties change copy local to true
  *  Now in the solution explorer, right click nopAzure/Roles, Add Web Role Project in solution, add Nop.Web Projects.
  *  Right click on nopAzure and hit publish. (it might now require you to install some Azure related software, do so)
  *  Under Windows Azure Publish Sign In screen. Sign in your Azure account to download credentials and import it.
  *  Hit next.
  *  Under Cloud Service, Create new, call it whatever you want and pick a closest region to where you want the server to be run from.
  *  Create a storage account since it's required but won't be used for now
  *  Check Enable Remote Desktop for all roles, create your remote desktop username, password.
  *  Check Enable Web Deploy for all web roles (I am not really sure what this does, someone help me out )
  *  Hit next, and you may publish this to your Azure Cloud Service, watch the progress in Visual Studio, it will take a while.
8.  Now we have to edit the hidden Settings.txt by remote desktop into our cloud service box. (let me know if anyone figure out a better way to do this)
  *  Go to https://manage.windowsazure.com, your Azure control panel, click on cloud services, click on your cloud service name, click on the instances tab on top. You will see some instance name such as Nop.Web_IN_0, select it and Hit connect on bottom to connect to your cloud service via remote desktop. Use the remote desktop login and password you created in step 7.
  *  Use file explorer, go to F:\sitesroot\0\App_Data, right click and create a text file called Settings.txt.  
  
      `DataProvider: sqlserver
      DataConnectionString: Data Source=tcp:{database server name}.database.windows.net,1433;
      Initial Catalog={your database name};
      Integrated Security=False;
      Persist Security Info=False;
      User ID={your data base server username}@{your database server name};
      Password={your password};
      MultipleActiveResultSets=True`
For example:
      `DataProvider: sqlserver
      DataConnectionString: Data Source=tcp:plpzhwxv1m.database.windows.net,1433;
      Initial Catalog=fence-land-db2;
      Integrated Security=False;
      Persist Security Info=False;
      User ID=prodev42@plpzhwxv1m;
      Password=xxxyyy;MultipleActiveResultSets=True`
    
9.  Now we are done. You may go visit your new azure website by {cloud service name}.cloudapp.net. However for admin project its reporting problems when putting it under nopAzure/Roles I am not sure why. I am thinking there might be 2 ways we can walk around this. First is to edit the local project's Setting.txt to be the same as Azure so we can access /admin locally and the settings will be saved in Azure database, thus effecting the azure website (I am assuming that's how it works). Secondly maybe we can drag a deployable directory to be under nopAzure/roles and deploy that to azure cloud service. Any expert please help out and continue from where I left off here…Also can someone let me know if there is a way to not have to recreate the VM for cloud service everytime when I change some source code and want to publish from Visual Studio? I don't want to keep recreating the Setting.txt by remote desktop into the VM afterwards and there are other issues involved which is better by not recreating new VM.
Il y a 10 ans
anyone know how to Modify DataSettingsManager.cs to not obtain connection setting from file but rather from Nop.Web role in nopCommerceAzure project using Microsoft.Windows.Azure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue()?

p.s i am currently trying to get \administration to deploy as well...it's working in emulator but not on azure cloud yet....
Il y a 10 ans
I was able to get version 3.0 to deploy and run as you done here.

without the admin code.

I tried again with the admin code but when you add that project it added it with it endpoint as :8080 a different IP port.

I not real good with Azure so I don't know if you can force the endpoint to be 80

It also reports the WebAdmin instant is unhealthy so I don't know what is up with that.
Il y a 10 ans
FWIW. When I run the application local using the VS Azure emulator. The admin section works fine.

When I run in the Azure Cloud server, I get random things don't seem to work that work fine in the emulator.

Maybe there is more to configure on the Azure Cloud Service?
Il y a 10 ans
caninobd wrote:
FWIW. When I run the application local using the VS Azure emulator. The admin section works fine.

When I run in the Azure Cloud server, I get random things don't seem to work that work fine in the emulator.

Maybe there is more to configure on the Azure Cloud Service?


yah i am able to do those in azure emulator as well just not when deployed :(after 1-2 weeks i gave up and is currently using VM plan instead of cloud service plan....cloud service plan is cheaper though i hope we could get it to work eventually...keep me updated on what u r doing plz.
Il y a 10 ans
i have hosted in my local iis . I am able to get NOP.WEB, but i am not able to get admin pages NOP.ADMIN . Could you please instruct me to configure for admin site in local IIS
Il y a 10 ans
The problem is this is a partial class and there is no extension point on something like this.  DataSettingsHelper and DataSettingsManager both need to be extensible.  Make it an Abstract Class instead of an interface to keep the default functionality but I am going to create another version to handle this scenario and will have to be careful with it when upgrades are done.

And no being a partial class is not extensible.  I should be able to swap out implementations.
Il y a 10 ans
phuff34 wrote:
The problem is this is a partial class and there is no extension point on something like this.  DataSettingsHelper and DataSettingsManager both need to be extensible.  Make it an Abstract Class instead of an interface to keep the default functionality but I am going to create another version to handle this scenario and will have to be careful with it when upgrades are done.

And no being a partial class is not extensible.  I should be able to swap out implementations.


okay the methods on DataSettingsManager are virtual.  I was in a hurry at my lunch break from work.  Nevermind!
Il y a 10 ans
Hi Guys,

Please could you advise?

I followed manual step by step.

I only didn't update connection string in Settings.txt  because its done previously and nopCommerce communicates with sql azure already.

DataProvider: sqlserver
DataConnectionString: Data Source=mc95brisi0.database.windows.net;Initial Catalog=noCom;User ID=xxx;Password=xxxx;Persist Security Info=False;MultipleActiveResultSets=True

But if I click http://nopex2.cloudapp.net/  address it gives me nopCommerce installation, but as far as I know its installed :-).

Last version of nopCommerce.

Thx a lot!

Radim
Il y a 9 ans
Hi Radim..  I'm running into the same problem, could you fix that?

thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.