RameyRoad
RameyRoad

Reputation: 490

Swagger and ServiceStack 4.0

First, I'll ask my question, then explain our problems found during testing. We can't seem to access the Swagger API on the resources route using ServiceStack 4.0. Is this still supported?

We're starting a greenfield project and are investigating ServiceStack. As recommended, we're using version 4.0 from http://ServiceStack.net. We've established a "Security" service and verified that /Security/User/username correctly returns our information about the user. End to end tests of ServiceStack are working great.

As we go forward, we also want to document our API using Swagger. It appears in our tests that the resources route is no longer supported, or at least is not working, in version 4.0. We've downloaded all the sample projects for guidance and they're all using ServiceStack 3.9.33, so not much luck using the samples. We've tried these local URLs for the Swagger resources snapshot:

localhost:85/resources
localhost:85/api/resources (with routing changes in the web.config
localhost:85/security/resources
localhost:85/api/security/resources (with routing changes in the web.config)

All with no luck. What are we missing?

Here is our AppHost class:

public class AppHost : AppHostBase
{
    public AppHost()
      : base("API Services", typeof(SecurityService).Assembly)
    {
    }

    public override void Configure(Container container)
    {
      Plugins.Add(new SwaggerFeature());
      Plugins.Add(new ValidationFeature());

      container.RegisterValidators(typeof(UserValidator).Assembly);
    }
}

And the relevant code from our Global.asax file:

protected void Application_Start(object sender, EventArgs e)
{
    new AppHost().Init();
}

We've got the lastest of all packages using NuGet and Visual Studio 2013. Any guidance for ServiceStack newbies is appreciated.

Upvotes: 4

Views: 445

Answers (1)

RameyRoad
RameyRoad

Reputation: 490

I wish the solution were smarter than this, if only so that I felt that I understood the problem, but removing and then reinstalling all ServiceStack packages via the package management console solved the issue. Thanks to all who helped me to debug.

Upvotes: 3

Related Questions