Oguz Karadenizli
Oguz Karadenizli

Reputation: 3505

Object null reference exception on generic ServiceStackController in ServiceStack Mvc

In ServiceStack this line is not correct.

userSession = this.Cache.Get(SessionKey); (Line:28)

Cache is null when this code is called.

My production site is broken now.

Any solution?

Upvotes: 1

Views: 154

Answers (1)

Oguz Karadenizli
Oguz Karadenizli

Reputation: 3505

Big mistake of me. This code

container.Register(new MemoryCacheClient());

MUST CALL BEFORE

    Plugins.Add(new AuthFeature(() => new OzUserSession(),
        new IAuthProvider[] {
            new OzCredentialsAuthProvider(appSettings)
        }));

But also ServiceStackController throw meaningful exception ( Cache could not resolved) because It has dependency to cache!

Upvotes: 1

Related Questions