ServiceStack:没有/swagger-ui/index.html [英] ServiceStack: No /swagger-ui/index.html

查看:73
本文介绍了ServiceStack:没有/swagger-ui/index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 ServiceStack 用于我的自定义服务,在没有 IIS 的独立模式下.

I am using ServiceStack for my custom service, in stand alone mode without IIS.

我想为我的服务添加文档,而不是 /metadata 所做的.我想试试 Swagger 插件.

I would like to add documentation for my services beyond what /metadata does. I thought to try the Swagger plug in.

我已将插件命令添加到我的配置中

I have added the plug-in command to my Config

        public override void Configure(Funq.Container container)
        {
            SetConfig(new EndpointHostConfig()
            {
                DefaultRedirectPath = "index.html",
                DebugMode = true,
                WriteErrorsToResponse = true,

                CustomHttpHandlers =
                {
                    { HttpStatusCode.Unauthorized, new AuthorizationErrorHandler() },
                    { HttpStatusCode.Forbidden, new AuthorizationErrorHandler() },
                    { HttpStatusCode.NotFound, new AuthorizationErrorHandler() }
                }

            });

            // For automatic generation of documentation to APIs
            Plugins.Add(new SwaggerFeature());
        }

现有服务继续工作,但尝试访问

The existing services continue to work, but attempting to access

/swagger-ui/index.html

/swagger-ui/index.html

给出未找到的错误.

https://github.com/ServiceStack/ServiceStack/wiki/Swagger-API

我真的必须自己设置这个页面吗?如果是这样,如何?

Do I have to actually set up this page myself? If so, how?

推荐答案

添加 ServiceStack.Api.Swagger NuGet 包应包含您需要的所有客户端资源.尝试更新 NuGet 包,因为您需要的所有客户端资源都应该已经在 /swagger-ui

Adding the ServiceStack.Api.Swagger NuGet package should include all the client side resources you need. Try updating the NuGet package as all the client side resources you need should already be in /swagger-ui

这篇关于ServiceStack:没有/swagger-ui/index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆