I’m working on a dashboard that will be hosted on IIS and use scheduled endpoints to make API calls every few hours. The API calls are used to populate cache variables with the returned data. the scheduled endpoints live in the dashboard.ps1 file. The cache variables are referenced by a separate page on the dashboard.
When I run the site locally my page is able to utilize the variables and display their content. Once I move to IIS the page does not seem to be able to reference the variables. Everything that uses the cache variable will have no content. Testing the variables in design terminal I see that they still have data.
Is there anything additional I need to do with cache variables to make them work on IIS? As I understand it once they are defined they should be available across any endpoint.
The only thing I had to, in IIS, was to make sure that the Application Pool user had the needed access to query the data that is put in the variables (in my case data from a Database).
No additional changes was needed.
Since you confirm that the Data is in the Cache variable using the design terminal, it should be working.
I’ve had issues with the timing of the endpoint schedule, and the schedule of the refreshing of the components that display the data. maybe thats relevant?
it would be helpful if you could share the code in the schedule, and the code to display the info.
Once I start the dashboard I can use the design terminal to see the $Cache:reportscache variable is populated. One of the areas I use the data is in an input section. I loop through the cache variable and create input fields off of it:
This loop creates no data off of the reportscache variable. I have also created another item that displays the count of items in reportscache and it shows 0 on IIS. When I run locally it correctly shows the number of items.
I’ve noticed similar behavior to this with IIS setup as well. Declaring a $Cache: var at the top of the page for instance, and it not being usable by commands executed with button clicks and such.
Eventually I created a scheduled endpoint to run regularly and re-declare the $Cache vars and that seems to be a work-around, but I don’t feel like this is a proper fix either.
I’m in a hurry, but with Quick look, it looks like the code to create the Checkboxes off the $Cache:reportscache, is in the -Content part on New-UDInput.
If i’m not mistaken, everything in -Content is build when the dashboard is made, and at that point the Cache variable is empty.
Is the page dynamic?