How to run rhino compute with token in the C# code?

Hi,

I cloned Rhino Compute repo GitHub - mcneel/compute.rhino3d: REST geometry server based on RhinoCommon and headless Rhino and tried to run it at my local with rhino token but it can’t load. From the screenshot you can see that the token was set in env variable and loaded properly but it seems rhino component can’t load. Any ideas how to fix?

Thanks

Do you have Rhino installed on this machine? Are you running this on Windows Server? Or just a regular Windows desktop?

Rhino was installed from https://www.rhino3d.com/www-api/download/direct/?slug=rhino-for-windows/8/latest on Windows desktop.

I tried it on windows server as well. the same result.

When you run the Rhino app on your Windows desktop, does it start normally (or do you get a licensing error)?

I always got a license error. RHINO_TOKEN was properly set in environment variables

Ok. The RHINO_TOKEN variable is really only used for core-hour billing purposes and that only takes effect when you are running on a machine with Windows Server (ie. Virtual Machine). To run on a desktop, you will need a standard Rhino license. This can be an eval version, or just a standard Rhino license. The reason your Rhino.Compute is failing is because it can’t find a license when it’s trying to load the core Rhino libraries.

it is running on a windows server installed with the build from the installation script. How would rhino use RHINO_TOKEN on windows server?

If you’re running on a Windows Server, then whenever Rhino starts up, it first checks for the environment variable and authenticates it before proceeding. My guess is that you may not have set the environment variable correctly (if Rhino itself is not starting). Follow the steps at the bottom of this guide to reset the environment variable using the correct auth token.

Thanks Andy. It’s fixed now by uninstalling everything and ran the first script from the installation page

$F=“/bootstrap_step-1.zip”;T="(Env:temp)\tmp([convert]::tostring((get-random 65535),16).padleft(4,‘0’)).tmp"; New-Item -ItemType Directory -Path $T; iwr -useb https://raw.githubusercontent.com/mcneel/compute.rhino3d/8.x/script/production/bootstrap_step-1.zip -outfile $T$F; Expand-Archive $T$F -DestinationPath $T; Remove-Item $T$F;& “$T\bootstrap_step-1\boostrap_step-1.ps1”