Reputation: 2914
Following the code example at this URL :
https://github.com/ServiceStack/ServiceStack/wiki/Self-hosting
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
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'.
I've shared my basic example code via dropbox :
ServiceStackSelfhosted.zip (2.5 MB)
ServiceStackSelfhosted_stripped.zip (8 Kb but needs nuget commands to be run)
Upvotes: 4
Views: 3284
Reputation: 2203
Apart from adding the SwaggerFeature Plugin, I also had to add the RazorFeature.
After adding RazorFeature, I was able to browse the Swagger UI.
public override void Configure(Container container)
{
//...
Plugins.Add(new RazorFormat());
Plugins.Add(new SwaggerFeature());
//...
}
Upvotes: 2
Reputation: 143284
Files in Self-Hosting are served from the executing /bin/Release Directory.
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.
Upvotes: 2