In this article, I will explain about how to deploy nopcommerce in IIS. Those who don't know NopCommerce is open source free Online stores application(just like flipcart,ebay). It is built on ASP.NET MVC. There are many features in NopCommerce. NopCommerce also support wide range of plug-ins. You can create your own plug-ins also. You can found more details about nopcommerce at http://www.nopcommerce.com/
Deployment methods
You can Deploy NopCommerce in two way
- Tools provided by NopCommerce(*.bat)
- Using Visual studio.
First method is very easy to implement. Second method need some extra work.
It is always better idea to deploy production code in local IIS host before deploying it in live server. If your developing asp.net application in visual studio you will use IISExpress to run the application. Most of the time IISExpress may not show those error which will be shown by IIS. For example when i run the nopCommerce in visual studio it worked properly but when i deployed it in Local IIS i fond a unknown error "Could not load type 'System.ServiceModel.Activation.HttpModule......."
Deploying using NopCommerce tools
- Assuming you already download NopCommerce with Source(At the time of writing this post nopCommerce_2.80_Source.rar is the latest version). You can download NopCommerce with source at http://www.nopcommerce.com/downloads.aspx
- Extract nopCommerce_2.80_Source.rar at your desired location. I am using F:\DotNetProjects.
- The extracted folder contains below items.
- In that folder Prepare.bat, Deploy.bat are the deployment tool given by NopCommerce.
- First Run prepate.bat it will display bunch of text in command prompt and finally Build success message.
- Now Run Deploy.bat again it will show you bunch of text in command prompt and finally Build success message. If you observe a new folder called Deployable is created automatically. This is our production code we need to deploy in Live Server.
- Before we deploy it in live server we will deploy it in local IIS. Now Just go to you iis manager.
- Expand the items in your left sidebar. Right click on Default Web Site and select Add Application form the menu.
- Enter details. Physical path field must be point to your Deployable folder.
- Now open your broser and enter http://localhost/nop.
- If there is no error it will redirect you to http://localhost/nop/install folder where you need to enter details like admin email,password, db connection details and click install.
- If everything is ok NopCommerse Will install successfully.
Error1:Could not load type 'System.ServiceModel.Activation.HttpModule' ... Problem Fix
At step 10 in above process you may get this error.
Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- If you got this error you can resolve it by using simple tool "aspnet_regiis.exe".
Just go to C:\Windows\Microsoft.NET\Framework64\v4.0.30319 (path may different for 32 bit pc)in your command prompt. Run the the tool like this. "aspnet_regiis.exe -iru" this will execute some command and the problem should fixed.
ERROR2:Setup failed: An error occurred while creating the database: CREATE DATABASE permission denied in database 'master'. error. fix
If you got this error there are different alternative you can fix this error. But I will explain most simple one only.
- Run NopCommerce.sln under nopCommerce extracted folder(Refer step 2).
- Run the NopCommerce Application (ctrl+f5). 3)It will prompt you to enter db details(refer step 11). Enter details as shown in step 11 and click install.
- This time you wont face any problem (as i told earlier at beginning).
- No go to F:\DotNetProjects\nopCommerce_2.80_Source\Presentation\Nop.Web\App_Data (may different in your pc) and copy InstalledPlugins.txt,Settings.txt to F:\DotNetProjects\nopCommerce_2.80_Source\Deployable\nop_2.80\App_Data(this is our Deployable folder)
- Now Go to http://localhost/nop.
If it asked for db details enter exact details you entered before.
- Voila! you successfully installed NopCommerce.
Deploying nopCommerce using Visual Studio
- Go back to your to Visual studio where you open nopCommerce solution and build the solution.
- Right click on Nop.Web click publish.
- This will prompt you through publish web wizard Enter details like Publish Method:File System,Physical path
- Now right click on Nop.Admin and publish with sub-directory as /Admin under same directory you selected in previous step.
- copy all files you found under /admin/bin to /bin.
- Now copy copy InstalledPlugins.txt,Settings.txt text to add_data folder(Just follow steps i explained in Errror2 section of this post).
- That's it everything is great now.
HostForLIFE.eu IIS 7.5 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.