Adding ServiceStack Refrences return 405 (not allowed)

I secured most of my services by adding annotations to my service implementations like so:

    [Authenticate]
    [RequiresAnyRole("User", "Administrator", "SysBizBusService")]

When I try to get the source code from Windows in VS2017 I get a 405 not allowed error. The screenshot shows the details:

I have already a generated file form a different server (OpsManagerDTOs.dtos.cs) and I can update this one without any problem, also after securing most of the services. Now I try another file with DTOs from another service which the client is using as well.

So I wonder if I can have files from TWO servers in the same project or if this is not possible.

And in the same context a second question: Is it possible to change the URL somewhere after having created the file or do I need to delete it (thats how I do it now). The background is, that I have a bunch of services and they run usually in docker containers. If I am debugging a client, I prefer to run the server in the debugger as well to see what is going on on the server side as well. In such cases, the URL is different (my dockerhost is on a separate machine for services I do not currently work on)

Update:
I tried to add a new project to the solution but it is the same problem (405). So what is called when a request to generate the DTOs is made? What could be the reson a 405 is returned?

Can you use Fiddler and paste the entire raw HTTP Response that’s returned.

Here it is:

HTTP/1.1 405 FileNotFoundException
Date: Fri, 27 Jul 2018 05:25:31 GMT
Content-Type: text/plain
Server: Kestrel
Content-Length: 0
Set-Cookie: ss-id=WEfSr1tpCXflvkPFRZ3m; path=/; samesite=lax; httponly
Set-Cookie: ss-pid=sDlGzRm1R16lYPdZBpta; expires=Tue, 27 Jul 2038 05:25:28 GMT; path=/; samesite=lax; httponly
Vary: Accept
X-Powered-By: ServiceStack/5.02 NETStandard/.NET

Don’t know what FileNotFound means in this context…

Can you also include the Request Headers with URL. Was there a response body? Something else is throwing that Exception as the Native Types Service doesn’t access any files. You need to try find the source of the Exception, e.g. try calling the URL directly to see if it gives any more info about the issue, enable debug logging and register Error Exception Handlers to inspect the StackTraces of any Exceptions thrown.

here is the Request:

GET http://linuxdev-tbws2:6082/types/csharp HTTP/1.1
Host: linuxdev-tbws2:6082
Connection: Keep-Alive

I tried http://linuxdev-tbws2:6082/types from the browser which works fine, I get a list of all languages you support
I tried http://linuxdev-tbws2:6082/types/csharp from the browser. It just shows a blank page, and fiddler shows the following:

GET http://linuxdev-tbws2:6082/types/csharp HTTP/1.1
Host: linuxdev-tbws2:6082
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Cookie: ss-id=WRnmWLDIv7k7ypl38B05; ss-pid=mDy7ESd9llflePPiiGvX
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1

HTTP/1.1 405 FileNotFoundException
Date: Fri, 27 Jul 2018 05:50:28 GMT
Content-Type: text/plain
Server: Kestrel
Content-Length: 0
Vary: Accept
X-Powered-By: ServiceStack/5.02 NETStandard/.NET

ok so it’s calling the right URL but there’s no more info about the error, you need to try track down the source of the Exception (my previous comment includes a number of tips). Also if you’ve registered any Request Filters disable them to see if they’re the cause.

Ok found it! Looks like a problem I already had… Registering these error handler is a good hint! It shows the following:
Ex: 'System.IO.FileNotFoundException: Could not load file or assembly ‘BediDto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’.

This problem is an old dependency issue (you recommended to put everything in a /lib directory) I had in a different service. Now this appears again in this service. I will add all those dependencies and I guess it will work then… Will write feedback asap.

Yep, I added this library to my “root” project and it is generating the file…

Regarding the other question: Is it possible to change the URL to get these files somewhere or do I need to delete it and fill the form again. Sometimes I like to retrieve it from a running docker container, sometimes from an instance currently running in the debugger…

Are you referring to the BaseUrl: in the generated DTOs? It returns what the server thinks its BaseUrl is which is determined by the incoming Request URL, but you can specify to use your own by setting Config.WebHostUrl in your AppHost.

From v5.1.0 (i.e. latest version on NuGet) you can also specify the BaseUrl for Add ServiceStack Reference with:

GetPlugin<NativeTypesFeature>().MetadataTypesConfig.BaseUrl = "...";

I refer to the second one, and since I do not have 5.1 installed yet, I need to delete and recreate the files if I like to change the server.

I was just looking at the HUGE release notes for 5.1 and searched for migration. Since I do not use the web stuff I jumped to the ServiceStack section. I just wonder is the upgrade backward compatible or do I need to change code that works with 5.0.2?? If not it is probably worth updating asap…

Like every release normal release ServiceStack tries to remain highly compatible but if you don’t want to read the entire release notes search for the words “breaking” or “changes” to skip to any changes.

The 5.1.1 Release Notes also has a Table of contents so you can quickly skip to sections that are relevant or you’re interested in.

OK, thanks, looks like I can upgrade as soon as I have solved my more basic other problem.