Authentication and Registration endpoints not working when published

I created an app following the steps in the video posted here (on creating the booking system):

https://docs.servicestack.net/autoquery-crud

All the endpoints work as expected in localhost. /auth/credentials and register work as expected as well.

But when I publish the app (using dotnet publish and then copying the contents of the publish folder on the server - Windows Server), weirdly enough, the auth and register endpoints throw 404 while all the other endpoints that I created explicitly continue to work.

I am probably missing something basic but I’ve been at this for hours and can’t figure it out.

This is what my AuthFeature config looks like (most of it is exactly the same as the template created it):

appHost.Plugins.Add(new AuthFeature(() => new CustomUserSession(),
            new IAuthProvider[]
            {
                new CredentialsAuthProvider(appSettings), /* Sign In with Username / Password credentials */
                new FacebookAuthProvider(appSettings), /* Create App https://developers.facebook.com/apps */
                new GoogleAuthProvider(
                    appSettings), /* Create App https://console.developers.google.com/apis/credentials */
                new MicrosoftGraphAuthProvider(appSettings), /* Create App https://apps.dev.microsoft.com */
                new JwtAuthProvider(appSettings)
                {
                    AuthKeyBase64 = base64Key,
                    RequireSecureConnection = false,
                    UseTokenCookie = true,
                    CreatePayloadFilter = (payload, session) => 
                    {
                        if (session != null)
                        {
                            payload["CreatedAt"] = session.CreatedAt.ToUnixTime().ToString();
                        }
                    }
                }
            }));

        appHost.Plugins.Add(new RegistrationFeature()); //Enable /register Service

I am not sure what else to share but happy to post any details here as needed. I can hit every other endpoint, just not the ones that seem to have been defined by the plugins.

EDIT:

Sorry, forgot to add the detail that I’m doing this via Postman. I have the following Postman config in Startup:

Plugins.Add(new PostmanFeature
        {
            EnableSessionExport = true
        });

Ok. Published it again and it has started working? I’m stumped but I guess this ticket can be closed.

Did you get a chance to look at any of the startup output when it was being hosted on Windows server? Sounds environment related, logs might point to a root cause.

Unfortunately, I didn’t check any logs. Just assumed it was a ServiceStack issue as the rest of the endpoints were working fine. I’ve been at this since this morning, I will check the server logs tomorrow to see if I find anything. I’ll post it here if I do.

Strangely enough, republish seems to have fixed it. I did change one thing, added SwaggerFeature plugin. I doubt that’s related but everything is working now as expected!

Excited to be able to use this in production now :slight_smile:

1 Like