BEC Windows Service Installation

In this article

To install BEC Windows Service

Separate Business Central server instance

Multiple LSBECWinServices on the same machine

SSL setup

To install BEC Windows Service

  1. Run LSBEC.WinService.Setup.NN.x.yyyy.exe and fill in the configuration values.

    Later, you can change these values in the C:\LSRetail\LSBEC\LSBECWinService\LSBEC.WinService.exe.config file.

    The BEC Windows Service requires .Net Framework 4.8.

     

         

  2. By default, the install folder is C:\LS Retail\LSBEC\LSBECWinService\

    Web Service Url: http://localhost:7048/BCSServerInstance/ODatav4/BECWebServices

  3. Click the Initial Setup action in the BEC Job page to create the BECWebServices BC web service.

  4. After a successful installation, you can manage the Windows Service from the Services management control.

    The logon user defaults to Local System, and must be changed to a user with permission to run the service, either a local administrator or execute netsh.exe. The logfile.txt will have this error:

    OnStart failed.  System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL https://+:8787/LSCentralService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---> System.Net.HttpListenerException: Access is denied

    C:\netsh http add urlacl url=http://+:8787/LSCentralService user=kassi

    This command adds a URL reservation for the specified URL namespace for the DOMAIN\user account. 
    Note: This login does not need to be a Business Central user, but must be in an Administrator group (local admin or domain admin).

       

  5. If the service does not start, look at the log files under C:\LS Retail\LSBEC\LSBECWinService\logs

    • Starting/Stopping the windows service is logged in logfile.txt
      • Always look here if service does not start.
    • BECLog.txt logs the data between the Windows Service and BECWebServices in BC.
      • It also logs errors when failing to connect to BC web service.
    • ChannelMgtLog.txt logs all data sent to and received from the Channel Management System.
      • This raw data is sent/received to/from the Channel Management System.
      • This is very useful when you are debugging what was sent/received.
      • This is also saved in the BEC Log table so you can also view it from BC.
    • SynXisLog.txt and SiteMinderLog.txt log data and errors when communicating with the Channel Management Systems.


  6. Test the connection from browser (Chrome) http://localhost:8787/LSCentralService/ping
    or https://channelmgt.lsretail.com:8787/LSCentralService/ping

    This ping does not check the connection to Business Central, but it does check if BEC is listening on the port for incoming web requests.

Separate Business Central server instance

It is recommended that the BEC Windows Service uses its own BC Server Instance.

Multiple LSBECWinServices on the same machine

You can install more than one LSBECWinService on the same machine:

  1. Create a copy of the C:\LS Retail\LSBEC\LSBECWinService folder -  called LSBECWinServiceNew

    1. C:\LS Retail\LSBEC\LSBECWinServiceNew     
      Change the config file in this folder.
  2. Open a CMD (command) window with admin privileges (run as adminI).

  3. C:\>sc.exe create "LSBECWinServiceNew"  binpath= "C:\LS Retail\LSBEC\LSBECWinService\LSBEC.WinService.exe"  DisplayName= "LSBEC New service name"  start= auto  

    Example:

    1. c:\>sc.exe delete  "LSBECWinServiceNew"
    2. c:\>net.exe start LSBECWinServiceNew
    3. c:\>net.exe stop LSBECWinServiceNew 

SSL setup

It is easy to use IIS to set up SSL that is used with the LSBECWinService (SynXis only).

If it is not an option to use IIS, you must modify the Behaviors.config file (SynXis only):

Copy

  <serviceBehaviors>
    <behavior name="MgtServiceBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
 
      <!-- TODO when not setting bindings in IIS (much simpler) then you can do it this way. certhash is the thumbprint 
      netsh.exe http show sslcert 
      Netsh.exe http delete sslcert ipport=0.0.0.0:8787  -->
      <!--  netsh http add sslcert ipport=0.0.0.0:8787 certhash=336ba90bc7f3f24732f29581e43b2fbe0a8adec3 appid={4dc3e181-e14b-4a21-b022-59fc669b0914}  -->
      
      <serviceCredentials>
        <serviceCertificate findValue="*.lsretail.com"
                            x509FindType="FindBySubjectName"
                            storeLocation="LocalMachine"
                            storeName="My"/>
      </serviceCredentials>
      
    </behavior>
  </serviceBehaviors>