扬鞭不工作的自托管ServiceStack服务 [英] Swagger not working on a self hosted ServiceStack Service

查看:228
本文介绍了扬鞭不工作的自托管ServiceStack服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继此URL的代码示例:

Following the code example at this URL :

https://github.com/ServiceStack/ServiceStack/wiki/Self-hosting

我创建了一个空的解决方案,粘贴以上C#代码到Program.cs中'跑的NuGet命令来获取所需的库和代码文件下面输入:

I created an empty solution, pasted the above C# code into 'program.cs' and ran the following nuget commands to get the required libraries and code files imported :

Install-Package ServiceStack
Install-Package ServiceStack.api.Swagger

该服务运行正常,招摇元数据是正确传递,而是试图访问时 /swagger-ui/index.html 我得到错误的处理程序找不到

The service runs fine, the swagger meta data is delivered correctly, but when trying to visit /swagger-ui/index.html I get the error 'Handler not found'.

我透过Dropbox分享我的基本的示例代码:

I've shared my basic example code via dropbox :

ServiceStackSelfhosted.zip (2.5 MB)

ServiceStackSelfhosted_stripped.zip (8 KB,但需求的NuGet命令来运行)

ServiceStackSelfhosted_stripped.zip (8 Kb but needs nuget commands to be run)

推荐答案

文件中自托管是从执行/斌/发行目录服务。

Files in Self-Hosting are served from the executing /bin/Release Directory.

请确保您设置的复制到输出目录复制如果较新的或复制始终的)的所有文件,你想ServiceStack能够访问。

Make sure you set the Copy to Output Directory to Copy if Newer (or Copy Always) for all files you would like ServiceStack to have access to.

这篇关于扬鞭不工作的自托管ServiceStack服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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