Deploying XOJO Web 2 on Windows 10

Using XOJO Web 2 app, that works perfectly.

Is it possible to compile and copy the EXE file so that we can do tests on another machine?
Without reinstalling XOJO.

We want to install this application on different machines with different versions of Windows and explorers.

As long as your license allows building executables for Windows, yes. Make sure that Windows is selected under Build Settings at the bottom of the navigator (left-hand pane in the IDE), then click “Build” in the toolbar. When the build is complete, a folder will open on your screen and you can compress and copy the files to another machine.

Installing Xojo is not required to run Xojo-made applications. You can also test your Xojo Web application while running in debug mode from other machines on the same network by accessing the server machine’s local IP address and the port the Xojo app is running on, IE: http://192.168.1.100:8080/

Thanks for answering Anthony.

When I compile, XOJO generates a 64-bit EXE for me.
This is what it leaves me:
App_Name Libs
App_Name Resources
The EXEC
Nine DLL libraries

If I copy all of this to another machine, should it work fine?
This is what you mean?

What follows is to open the browser and call the application. It is right?

Yes, you would copy everything in the build folder to the other machine, launch the executable, then access it from the browser.

https://documentation.xojo.com/topics/application_deployment/web/deployment_overview.html

Once copied, instead of launching the app by double-clicking it, you can create a service for it in the command line:

sc create myXojoAppService type= own start= auto binpath= c:\myFolder\myApp.exe

Then launch on the command line:

services.msc

Now, “myXojoAppService” will appear in the list, and you can start it, or configure it as such, that it will run automatically after a reboot. Probably not necessary in your scenario, but perhaps helpful to others who want to run the app as an “intranet webServer” on a Windows Server.

3 Likes

Wow !!!
Excellent recommendation.

Thank you very much, Jeannot, for sharing it.

1 Like

I would only setup a service if you intend the application to stay on that machine and running, or you need to remove the service when you’re done testing. If you leave the service installed but delete the application, the user can encounter error messages on reboot. I really wouldn’t create a service for platform testing.

2 Likes

Yes, of course. Didn’t have in mind that someone could have seen this as a recommendation for testing purposes only, but you are right to address this.

I referred to the title of this thread “Deploying(!) Xojo Web2 on Windows 10” and I think it is quite easy on Windows to implement a service, at least for a simple Intranet for a few people. For larger deployments, you will still need your own webserver, load balancing, etc.

If you need to delete the service, first stop it on the command line and delete it:

SC STOP myServiceName
SC DELETE myServiceName

And of course, everyone should google a bit around “SC” to learn more about Windows Services. One might need administration rights for the app, keep in mind that paths are different, etc.

This might prove useful:

Protected Function getCreateWindowsService(appFile As FolderItem, serviceName As String = "", startService As Boolean = False, autoStart As Boolean = True, failureRestart As Boolean = True, failureRestartResetSeconds As Integer = 120, firewallIn As Boolean = True, firewallOut As Boolean = True) As String
  #If TargetWindows Then
    Var tempString As String
    Var tempShell As New Shell
    Var returnResults As String
    
    If appfile = Nil Or Not appFile.Exists Then Return "Application not found"
    
    If serviceName = "" Then serviceName = appfile.NameWithoutExtensionMBS
    serviceName = serviceName.ReplaceAll(" ", "") 'in case there are spaces in the file name!
    
    'stop any old Windows Service
    'tempString = "sc stop " + serviceName
    'tempShell.Execute(tempString)
    'if tempShell.ExitCode <> 0 then returnResults = returnResults + tempShell.Result + EndOfLine
    
    ''delete any old Windows Service
    'tempString = "sc delete " + serviceName
    'tempShell.Execute(tempString)
    'if tempShell.ExitCode <> 0 then returnResults = returnResults + tempShell.Result + EndOfLine
    
    'create the new Service
    tempString = "sc create " + serviceName + " binpath= " + Encodings.UTF8.Chr(34) + appfile.NativePath + Encodings.UTF8.Chr(34) + If(autoStart, " start= auto", "")
    tempShell.Execute(tempString)
    If tempShell.ExitCode <> 0 Then returnResults = returnResults + tempShell.Result + EndOfLine
    
    'set the Service to restart twice after two seconds then if it still fails then wait for failureRestartResetSeconds seconds
    If failureRestart Then
      tempString = "sc failure " + serviceName + " actions= restart/2000/restart/2000// reset= " + failureRestartResetSeconds.ToString
      tempShell.Execute(tempString)
      If tempShell.ExitCode <> 0 Then returnResults = returnResults + tempShell.Result + EndOfLine
    End If
    
    If startService Then
      tempString = "sc start " + serviceName
      tempShell.Execute(tempString)
      If tempShell.ExitCode <> 0 Then returnResults = returnResults + tempShell.Result + EndOfLine
    End If
    
    'add the application to the Windows Firewall for incoming traffic
    If firewallIn Then
      tempString = "netsh advfirewall firewall add rule name=" + Encodings.UTF8.Chr(34) + serviceName + Encodings.UTF8.Chr(34) + " dir=in action=allow program=" + Encodings.UTF8.Chr(34) + appfile.NativePath + Encodings.UTF8.Chr(34) + " enable=yes "
      tempShell.Execute(tempString)
      If tempShell.ExitCode <> 0 Then returnResults = returnResults + tempShell.Result + EndOfLine
    End If
    
    'add the application to the Windows Firewall for outgoing traffic
    If firewallOut Then
      tempString = "netsh advfirewall firewall add rule name=" + Encodings.UTF8.Chr(34) + serviceName + Encodings.UTF8.Chr(34) + " dir=out action=allow program=" + Encodings.UTF8.Chr(34) + appfile.NativePath + Encodings.UTF8.Chr(34) + " enable=yes "
      tempShell.Execute(tempString)
      If tempShell.ExitCode <> 0 Then returnResults = returnResults + tempShell.Result + EndOfLine
    End If
    
    If returnResults = "" Then
      Return "No error"
    Else
      Return returnResults
    End If
  #EndIf
      
End Function
6 Likes