InstallationSingle Server Deployment

Single Server Deployment

Configure the Connection Strings

In the previous steps, we have explained how to set up the Sana Commerce SQL database and the optional setting of the NAS. Now you have to configure the Sana Commerce Starter Site and backoffice web applications, so they can connect to these data stores. 
  • Open the 'web.config' file of the 'Sana.Commerce.StarterSite' project in any text editor ('Notepad' for example).
  • Locate the 'connectionStrings' configuration section:
<connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=SERVERNAME\INSTANCENAME;Initial Catalog=DATABASENAME;User Id=USERNAME;Password=PASSWORD;MultipleActiveResultSets=true;" providerName="System.Data.SqlClient"/>
    <add name="NavisionStandardService" connectionString="NAVSERVICEURL"/>
</connectionStrings>


In case of using NAV 2009 you should change the standard NAV connection (NavisionStandardService) to the following format:
<add name="Nav2009StandardWebService" connectionString="NAV2009WEBSERVICEURL"/>
Replace the 'NAV2009WEBSERVICEURL' tag 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 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#: NAV 2009 service instance name.
#COMPANYNAME#: The name of the company in 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.
    (The NAS service can be extended only with 'Timeout' parameter, for example: 'Url=http://#PROTOCOL#://#SERVERNAME#:#PORT#/navision;Timeout=600' )
  • These additional parameters and their values must be separated by semicolon.
Below you can see an example of the extended connection string for NAV2009 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"
  • Replace the following tags:
    #SERVERNAME\INSTANCENAME#: Database server name or IP address of the SQL database server and optionally the SQL server instance name. For example, SERVER06 used in 'Install the NAS'.
    #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.
    #NAVSERVICEURL#: This tag has the following form:
    "#WCFPROTOCOL#://#NASSERVER#:#NASPORTNUMBER#/navision" 

    where:
    #WCFPROTOCOL#: the protocol which is used for connecting to the WCF service (HTTP or HTTPS)
    #NASSERVER#: is the name or IP address of the server running the NAS used in 'Configure the NAS'. When running the Sana Commerce startup code unit from the NAV client, enter 127.0.0.1.
    #NASPORTNUMBER#: is the port number to which the Sana Commerce MS Dynamics NAV Service is listening. For NAV with Pebblestone Fashion module the default port number is 6001, for NAV Standard it is 6002.

  • Open the 'web.config' file of the 'Sana.Commerce.BackOffice' project in any text editor.
  • 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>
  • Replace the #FRONTENDURL# tag, which should have the following form:
  • "#ROTOCOL#://#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


  • Locate the 'connectionStrings' configuration section:
<connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=SERVERNAME\INSTANCENAME;Initial Catalog=DATABASENAME;User Id=USERNAME;Password=PASSWORD;"/>
    <add name="NavisionStandardService" connectionString="NAVSERVICEURL"/>
</connectionStrings>
  • Replace the following tags:
    #SERVERNAME\INSTANCENAME#: Database server name or IP address of the SQL database server and optionally the SQL server instance name. e.g. DEV-UA-WS003\SQLEXPRESS used in 'Install the NAS'.
    #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.
    #NAVSERVICEURL#: This tag has the following form:
    "#WCFPROTOCOL#://#NASSERVER#:#NASPORTNUMBER#/navision"

    where:
    #WCFPROTOCOL#: the protocol which is used for connecting to the WCF service (HTTP or HTTPS)
    #NASSERVER#: is the name or IP address of the server running the NAS used in 'Configure the NAS'. When running the Sana Commerce startup code unit from the NAV client, enter 127.0.0.1.
    #NASPORTNUMBER#: is the port number to which the Sana Commerce MS Dynamics NAV Service is listening. For NAV with Pebblestone Fashion module the default port number is 6001, for NAV Standard it is 6002.

    In case of using NAV 2009 you should change the default connection string and configure it instead of the original one. You can read about it in the note earlier in this step.

  • Locate the 'client' configuration section under the 'system.serviceModel' node:
<client>
   <endpoint address="FrontendUrl/Management/PublishWebService.asmx" binding="basicHttpBinding" bindingConfiguration="PublishWebServiceSoap" contract="PublishService.PublishWebServiceSoap" name="PublishWebServiceSoap" />
</client>
  • Replace the 'FrontendUrl'  address part, which should have the following form:
  • "#WCFPROTOCOL#://#WEBSITEDOMAINNAME#:#PORT#"
  • where: 
  • #WCFPROTOCOL#: the protocol which is used for connecting to the WCF service (HTTP or HTTPS)
    #WEBSITEDOMANINAME#: Website address that is registered in the DNS servers of your network.
    #PORT# (optional): Port number, if it is not the default HTTP port number (80).
You can find more information about different SQL connection strings here: http://connectionstrings.com/sql-server-2005
 
InstallationSingle Server Deployment