Reputation: 442
I've just updated from ServiceStack 4.0.24 to 4.0.50 but now getting the session throws an InvalidCastException when attempting
return this.SessionAs<ScadaSession>();
Additional information: Unable to cast object of type 'ServiceStack.AuthUserSession' to type 'Scada.Web.ServiceInterface.ScadaSession'.
The only other change in the project is updating the license key to allow me to use the newer build. I've had a read through the release notes and I can't see anything flagged a breaking change that would appear to affect me but if there is something new I have to add to my ScadaSession class, which at the moment inherits nothing, and suggestions are greatly appreciated.
Upvotes: 0
Views: 55
Reputation: 143399
You need to register the Custom Session Type you're using when you register the AuthFeature plugin, e.g:
Plugins.Add(new AuthFeature(() => new ScadaSession(),
new IAuthProvider[] { ... }));
Your ScadaSession
also needs to inherit AuthUserSession
(if it doesn't already).
Upvotes: 2