MissingMethodException get_QueryString

2019-08-14 09:54发布

问题:

I come across this exception in my .net core app (.net core 2.1 and I'm using service stack 5.2).

Method not found: 'ServiceStack.Web.INameValueCollection ServiceStack.Web.IRequest.get_QueryString()'.

It comes from one of the plugins originally, but I can't figure out why. Code breaks on this line here.

session.ReferrerUrl = GetReferrerUrl(authService, session, request);

Btw, in app console I also get this:

warn: ServiceStack.Serialization.StringMapTypeDeserializer[0] Property 'redirect' does not exist on type 'ServiceStack.Authenticate'

...but I don't think that's related to the exception above.

Any hints what might be a problem?

回答1:

There is no INameValueCollection on IRequest anymore that was replaced last year with NameValueCollection from v5+, whatever v4 code you have that's using it needs to be recompiled with the same version as the rest of your project.

To get a clean upgrade make sure all your projects are referencing the same ServiceStack version, delete your /bin and /obj folders and try restoring from NuGet again.

If it’s still an issue clear your NuGet Cache and restore again:

warn: ServiceStack.Serialization.StringMapTypeDeserializer[0] Property 'redirect' does not exist on type 'ServiceStack.Authenticate'

This is irrelevant it's just a warning that there was a redirect property on Request DTOs, I've added it to the ignore list in this commit.

nuget locals all -clear