/metadata redirect problem when hosting in IIS virtual application

I suspect this problem was introduced with version 4.5.12.

I’m hosting my service in a virtual application, e.g.http://myserver/myapi

I expect to to get a redirect to the http://myserver/myapi/metadata url when opening the base address (without the /metadata-part) of the service in a browser. But instead the the Location-header of the redirect points to the base server address http://myserver/metadata, resulting in a 404.

Are there any changes in the latest version that might have resulted in this error?

Can you post your SetConfig() if you have any, also the Raw HTTP Headers showing the Request and Response redirect.

Hi,

new HostConfig
{
UseHttpsLinks = true,
ApiVersion = serviceType.GetAssembly().GetName().Version.ToString(),
DebugMode = false
}

Request+response headers

Request URL:http://tvm-webatlashar/WAAPI-BestillingsService/
Request Method:GET
Status Code:302 Found
Remote Address:192.168.3.104:80
Referrer Policy:no-referrer-when-downgrade

Response Headers
view source
Access-Control-Allow-Headers:content-type,accept,x-waapi-token,x-waapi-source,x-waapi-profile,accept,authorization
Access-Control-Allow-Methods:GET, POST, PUT, DELETE, PATCH, OPTIONS
Access-Control-Allow-Origin:*
Access-Control-Expose-Headers:Location
Cache-Control:private
Content-Length:0
Date:Wed, 21 Jun 2017 15:52:24 GMT
Location:http://tvm-webatlashar/metadata
Server:Microsoft-IIS/8.0
Vary:Accept
X-AspNet-Version:4.0.30319
X-Powered-By:ASP.NET
X-Powered-By:ServiceStack/4.512 NET45 Win32NT/.NET

Can you try adding:

new HostConfig
{
    DefaultRedirectPath = "~/metadata"
}

to see if that helps?

Otherwise let me know if specifying the BaseUrl works, i.e:

new HostConfig
{
    WebHostUrl = "http://tvm-webatlashar/WAAPI-BestillingsService/"
}