I have an existing ServiceStack project that I have ported to .Net Core - and the project works and runs mostly as expected, apart from the /metdata
feature.
The /metdata
returns a 403 Metadata Not Visible
, but that doesn’t make any sense, as the configuration is
self.SetConfig(new HostConfig
{
// Disable unused features, such as SOAP.
EnableFeatures = Feature.All.Remove(Feature.Soap11 | Feature.Soap12),
StrictMode = true,
DebugMode = debugMode,
AddRedirectParamsToQueryString = true,
UseCamelCase = true,
AdminAuthSecret = "xxxSecretxxx",
});
When I’m looking at the ServiceStack source I see there is only one instance of that error message https://github.com/ServiceStack/ServiceStack/blob/79b972aa5509d77d2e770759d96e22a51f92a5e1/src/ServiceStack/ServiceStackHost.Runtime.cs#L430 and since I’ve not changed MetadataVisibility
I don’t see why that code path should fail at all.
This is is consistent with .Net Core 2.0 and 2.1, on Linux (Ubuntu), macOs and Windows.
Notice that the metadata page works correctly on our .Net 4.6 branch.
The functionality of the backend apart from the /metdata
page appears to work as expected.
The port to .Net Core was done by creating a new .Net Core solution, with the same projects, and then all files were moved over and packages added again in .Net Core.
This caused a diff of only the new .Net Core files, and all other files are unchanged,
and therefore allows us to keep the .Net Core branch in sync (rebase) from our develop branch. With this approach we also avoided keeping any cruft around from the old sln
and csproj
files that could possibly influence anything.
I’m a bit stumped on how to find the error, and what piece of the project/code that could possibly cause this behaviour, and would appreciate pointers.