Swagger not able to retrieve operations from ServiceStack resources Service

Viewed 1413

I am trying to get Swagger to work with ServiceStack. The web server is located behind a Firewall and accessed from the Internet (my.domain.de:80). Requests are then forwarded to the web server on Port 8070.

When visiting the swagger page it is able to access /api/resources and retrieve the List of ServiceMethods, but then fails to retrieve the List of Operations.

When I use fiddler to inspect the result I see that he /api is missing so that swagger tries to get the List of Operations from /resources/ServiceName instead of /api/resources/ServiceName.

The Swagger-UI gives me the following error message:

Unable to read api 'ServiceName' from path http://my.domain.de/resource/ServiceName (server returned Not Found)

SwaggerConfig:

discoveryUrl:"../../api/resources",

ServiceStack Config:

WebHostUrl = "http://my.domain.de"

Update(2) If I dont set the WebHostUrl the BasePath in the initial response from ServiceStacks resources service contains the portnumber from the webserver basePath=http://my.domain.de:8060/api. But on the Firewall this port is not reachable, nor do we want it to be reachable.

web.config:

<location path="api">
    <system.web>
        <httpHandlers>
            <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
        </httpHandlers>
    </system.web>

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
            <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
        </handlers>
    </system.webServer>
</location>

Update

in the Inital response the basepath is:

basePath=http://my.domain.de

and by my.domain.de I mean a real world url which is just the hostname without port, url-path, querystring or fragment (I acctually checked wikipedia for the correct names ;)

I have found this other question on StackOverflow, but it did not help me. Swagger with Service Stack not working

How can I get ServiceStack/Resources Service to either add /api for its returned ServiceList?

1 Answers
Related