Closed cquirosj closed 8 years ago
Hi @cquirosj,
I'm having the same issue..maybe we can have a fix for this so we wont have to use this workaround of downloading version 1.0.8.0 of DocsByReflection?
Still I'm having issues generating the C# proxy file.
This is my config file in visual studio:
<proxy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://webapiproxy.github.io/schemas/client-config.xsd"
endpoint="http://localhost:8888/proxies/"
generateOnBuild="true"
/>
I'm getting this error in Visual Studio 2015:
Error The "ProxyGenerationTask" task failed unexpectedly.
WebApiProxy.ConnectionException: WebApiProxy: Could not connect to remote server - http://localhost:8888/proxies/
at WebApiProxy.Tasks.ProxyGenerationTask.tryReadFromCache()
at WebApiProxy.Tasks.ProxyGenerationTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.
This is the output:
1>C:\tfs\packages\WebApiProxy.CSharp.1.0.4.7731\build\WebApiProxy.CSharp.targets(9,5): error MSB4018: The "ProxyGenerationTask" task failed unexpectedly.
1>C:\tfs\packages\WebApiProxy.CSharp.1.0.4.7731\build\WebApiProxy.CSharp.targets(9,5): error MSB4018: WebApiProxy.ConnectionException: WebApiProxy: Could not connect to remote server - http://localhost:8888/proxies/
1>C:\tfs\packages\WebApiProxy.CSharp.1.0.4.7731\build\WebApiProxy.CSharp.targets(9,5): error MSB4018: at WebApiProxy.Tasks.ProxyGenerationTask.tryReadFromCache()
1>C:\tfs\packages\WebApiProxy.CSharp.1.0.4.7731\build\WebApiProxy.CSharp.targets(9,5): error MSB4018: at WebApiProxy.Tasks.ProxyGenerationTask.Execute()
1>C:\tfs\packages\WebApiProxy.CSharp.1.0.4.7731\build\WebApiProxy.CSharp.targets(9,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\tfs\packages\WebApiProxy.CSharp.1.0.4.7731\build\WebApiProxy.CSharp.targets(9,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.
Although the error of version 1.0.8.0 docsByReflection disapeared when I browse to:
http://localhost:8888/proxies/
and it looks like I do get the javascript proxy of my web api..but for some reason the C# proxy isnt being generated..
Any idea?
Hi gregoks,
I got my proxy generated after I found there was even more library dependencies mismatching the original version used by the developer. I solved the problem downloading the code and debugging it, getting right all the dependencies.
Even when having this tool to generate the proxy is very convenient, maybe you would just like to do it more manually. By reading the code generated by this tool I found, that it makes uses of HttpClient.PostAsJsonAsync which was introduced in framework 4.5.x .. with this you can basically consume any REST json webserivice and automatically translate the response to DTOs in your client. You will need to code the DTOs again in your client but that is usually not much work. Also to avoid having to code the DTOs twice, you could improve your code server side to have an assembly just for the DTOs.. that way you can freely distribute that assembly for your consumers without sharing binaries of the services implementations. Lets say you have a library called API where you have the services. And you have another assembly called API.public where you code the messages classes and DTOs, meant to be used you API assembly and by consumers.
Here is an article I found that explains everything, in this particular case the example suggest you create the DTO in your client (not as I suggested about having a shared assembly with just DTOs) http://www.asp.net/web-api/overview/advanced/calling-a-web-api-from-a-net-client
Hope this helps.
Best regards,
Christian.
This issue (or part of) has been addressed in #75. Closing it for now. Everything looks stable now.
Hello, I just wanted to report a problem and a workaround. This happened while using Visual Studio 2015 community edition, installing the package WebApiProxy in a project that uses framework 4.6 the command downlaods DoscByReflection nuget package version 1.0.11 and when I visit /api/proxies I get the error "Could not load file or assembly 'DocsByReflection, 1.0.8.0 The located assembly's manifest definition does not match the assembly reference." What I did was to specifically install the version needed by executing install-package DocsByReflection -Version 1.0.8.0 -DependencyVersion Highest