InstallationInstall Sana Commerce Webshop on Web and Database Server

Install Sana Commerce Webshop on Web and Database Server

Configure the Connection Strings

Now you have to configure the Sana Commerce Starter Site and backoffice web applications, so they can connect to the data stores.
 
If separate Microsoft Dynamics NAV 2009 Server services are used for each Sana Commerce subsystem, then perform configuration of the connection strings for each NAV 2009 WebService. More detailed information about how to do this can be found in the 'Multiple NAV 2009 Server Services' chapter.
 

Step 1: Open the 'web.config' file of the 'Sana.Commerce.StarterSite' project in any text editor ('Notepad' for example).

Step 2: Locate the 'connectionStrings' configuration section:

<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="IndexDirectory" connectionString="IndexDirectoryFolder"/>
<add name="LocalSqlServer" connectionString="Server=ServerName\InstanceName;initial catalog=DatabaseName;User Id=Username;Password=Password;MultipleActiveResultSets=true;"/>
<add name="AxWebService" connectionString=
"EndPointConfigurationName=AX;UserName=UserName;Password=Password;Domain=Domain;"/>
<add name="NavisionStandardService" connectionString="NavisionServiceUrl"/>
</connectionStrings>

Step 3: Delete the following line:

<add name="AxWebService" connectionString=
"EndPointConfigurationName=AX;UserName=UserName;Password=Password;Domain=Domain;"/>

Step 4: Replace the 'NAVISIONSERVICEURL' value with the following address:

#PROTOCOL#://#SERVERNAME#:#PORT#/#NAVINSTANCENAME#/WS/#COMPANYNAME#/Codeunit/SC_NAV2009_WebService

where:
#PROTOCOL#: the protocol which is used for connecting to the Microsoft Dynamics NAV 2009 service (HTTP or HTTPS).
#SERVERNAME#: the name or IP address of the developer workstation running the NAV 2009 Server service.
#PORT#: the port number to which the Sana Commerce NAV service is listening.
#NAVINSTANCENAME#: Microsoft Dynamics NAV 2009 service instance name.
#COMPANYNAME#: The name of the company in Microsoft Dynamics NAV 2009 database. Please read about the rules for encoding the special characters in company names as part of a URL here: http://msdn.microsoft.com/en-us/library/ee414220.aspx.

If you need to specify the user who will be connected to the NAV Webservice do the following:

  • The connectionString attribute in the connectionStrings section can be extended with additional information about UserName, Domain, and Password.
  • Now it is possible to specify Timeout for the connection. If this parameter is not specified, the default value (60 sec) will be used.
  • These additional parameters and their values must be separated by semicolon.
Below you can see an example of the extended connection string for Microsoft Dynamics NAV 2009 webservice:
connectionString="Url=http:// domain.com:7047/DynamicsNAV/WS/CompanyName/Codeunit/SC_NAV2009_WebService; UserName=YourUserName;Password=YourPassword;Domain=YOURDOMAIN;Timeout=100 "

The additional parameters are optional. The "classic" version of connection string (without specifying any additional parameters) is also supported:

connectionString=http:// domain.com:7047/DynamicsNAV/WS/CompanyName/Codeunit/SC_NAV2009_WebService"

Step 5: Replace the following values:

#INDEXDIRECTORYFOLDER#: The path to the folder where the index files are stored.
#SERVERNAME\INSTANCENAME#: Database server name or IP address of the SQL database server and optionally the SQL server instance name. 
#DATABASENAME#: Name of the SQL database used in 'Setup the SQL Database'.
#USERNAME#: Database username used in 'Setup the SQL Database'.
#PASSWORD#: Password of the database user.

Step 6: Open the 'web.config' file of the 'Sana.Commerce.BackOffice' project in any text editor.

Step 7: Locate the 'appSettings' configuration section:

<appSettings>
     <add key="FrontendUrl" value="ShopUrl"/>
     <add key="FrontendPath" value="PhysicalPathToFrontendFolder"/>
     <add key="FrontendContentPath" value="PhysicalPathToFrontendFolder\content\files"/>
     <add key="FrontendThumbnailPath" value="/content/files/images/ProductImages/Small/"/>
</appSettings>
More detailed information about frontend and frontend content paths can be found here.

Step 8: Replace the #FRONTENDURL# value, which should have the following form:

"#PROTOCOL#://#WEBSITEDOMAINNAME#:#PORT#"

where:
#PROTOCOL#: the protocol which is used for connecting to the SC website (HTTP or HTTPS).
#WEBSITEDOMANINAME#: the website address that is registered in the DNS servers of your network.
#PORT# (optional): the port number when it is not the default HTTP port number (80).

Attribute 'FrontendThumbnailPath' specifies the path to the folder which is used for storing the product images.
Attribute 'FrontendContentPath' specifies the folder which is used for storing the content files.

If your website and backoffice have different domains you should create the 'images' virtual directory in the
'BackOffice' website in IIS with the path to the original 'images' directory in the 'StarterSite' website.
This is done in order for HTML editor in backoffice to manage the content images correctly.

'Images' Virtual Directory in the 'Backoffice' Website in IIS

Step 9: Locate the 'connectionStrings' configuration section:

<connectionStrings>
<clear/>
<add name="IndexDirectory" connectionString="IndexDirectoryFolder"/>
<add name="LocalSqlServer" connectionString="Server=ServerName\InstanceName;initial catalog=DatabaseName;User Id=Username;Password=Password;MultipleActiveResultSets=true;" />
<add name="AxWebService" connectionString=
"EndPointConfigurationName=AX;UserName=UserName;Password=Password;Domain=Domain;"/>
<add name="NavStandardService" connectionString="NavisionServiceUrl"/>
</connectionStrings>

Step 10: Delete the following line:

<add name="AxWebService" connectionString=
"EndPointConfigurationName=AX;UserName=UserName;Password=Password;Domain=Domain;"/>

Step 11: Replace the following values:

#INDEXDIRECTORYFOLDER#: The path to the folder where the index files are stored.
#SERVERNAME\INSTANCENAME#: Database server name or IP address of the SQL database server and optionally the SQL server instance name.
#DATABASENAME#: Name of the SQL database used in 'Setup the SQL Database'.
#USERNAME#: Database username used in 'Setup the SQL Database'.
#PASSWORD#: Password of the database user.
#NAVISIONSERVICEURL#: This value has the following form:
#PROTOCOL#://#SERVERNAME#:#PORT#/#NAVINSTANCENAME#/WS/#COMPANYNAME#/Codeunit/SC_NAV2009_WebService

where:
#PROTOCOL#: the protocol which is used for connecting to the Microsoft Dynamics NAV 2009 service (HTTP or HTTPS).
#SERVERNAME#: the name or IP address of the developer workstation running the Microsoft Dynamics NAV 2009 Server service.
#PORT#: the port number to which the Sana Commerce NAV service is listening.
#NAVINSTANCENAME#: Microsoft Dynamics NAV 2009 service instance name.
#COMPANYNAME#: The name of the company in Microsoft Dynamics NAV 2009 database. Please read about the rules for encoding the special characters in company names as part of a URL here: http://msdn.microsoft.com/en-us/library/ee414220.aspx.

You can find more information about different SQL connection strings here: http://connectionstrings.com/sql-server-2005.