We are using ASP.NET Core and Angular 2 template for our application. Unable to generate service proxies . After running swagger we are able to see the API , but the method proxy is not generated in the serviceproxy.ts file after executing refresh.bat in nswag folder. Really stuck at this critical time . Please help !!!! Unable to locate error in the Logs.txt file .
4 Answer(s)
-
0
Hello I use the same project template.
The way I use it as follows: 1- Run the server-side application (in debug or not in debug doesn't matter) 2- Go to the angular app, on the command go to nswag folder and then type "refresh.bat" 3- The proxies should be generated now
One thing that happens to me is that, I am using VS Code, so every time I run refres.bat, I have to close VS Code and open it again. then I will be able to see all new and updated proxies.
Try it
HTH
-
0
<cite>bilalhaidar: </cite> Hello I use the same project template.
The way I use it as follows: 1- Run the server-side application (in debug or not in debug doesn't matter) 2- Go to the angular app, on the command go to nswag folder and then type "refresh.bat" 3- The proxies should be generated now
One thing that happens to me is that, I am using VS Code, so every time I run refres.bat, I have to close VS Code and open it again. then I will be able to see all new and updated proxies.
Try it
HTH
==================== Hi. Tried to do your way but getting following error :
System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Sequence contains more than one matching element at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable
1 source, Func
2 predicate) at NSwag.CodeGeneration.TypeScript.Templates.RequestBodyTemplate.TransformText() in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration.TypeScript\Templates\RequestBodyTemplate.tt:line 2 at NSwag.CodeGeneration.TypeScript.Templates.AngularClientTemplate.TransformText() in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration.TypeScript\Templates\AngularClientTemplate.tt:line 50 at NSwag.CodeGeneration.TypeScript.Templates.AngularClientTemplate.Render() in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration.TypeScript\Templates\AngularClientTemplate.Extensions.cs:line 18 at NSwag.CodeGeneration.ClientGeneratorBase3.GenerateFile(SwaggerDocument document, ClientGeneratorOutputType type) in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration\ClientGeneratorBase.cs:line 90 at NSwag.Commands.SwaggerToTypeScriptClientCommand.<<RunAsync>b__100_0>d.MoveNext() in C:\Data\Projects\NSwag\src\NSwag.Commands\Commands\SwaggerToTypeScriptClientCommand.cs:line 265 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.SwaggerToTypeScriptClientCommand.<RunAsync>d__100.MoveNext() in C:\Data\Projects\NSwag\src\NSwag.Commands\Commands\SwaggerToTypeScriptClientCommand.cs:line 256 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.SwaggerToTypeScriptClientCommand.<RunAsync>d__99.MoveNext() in C:\Data\Projects\NSwag\src\NSwag.Commands\Commands\SwaggerToTypeScriptClientCommand.cs:line 249 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.NSwagDocumentBase.<ExecuteAsync>d__28.MoveNext() in C:\Data\Projects\NSwag\src\NSwag.Commands\NSwagDocumentBase.cs:line 187 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.Document.ExecuteDocumentCommandBase.<ExecuteDocumentAsync>d__5.MoveNext() in C:\Data\Projects\NSwag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommandBase.cs:line 52 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.Document.ExecuteDocumentCommandBase.<RunAsync>d__4.MoveNext() in C:\Data\Projects\NSwag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommandBase.cs:line 39 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NConsole.CommandLineProcessor.<ProcessSingleAsync>d__12.MoveNext() in C:\projects\nconsole\src\NConsole\CommandLineProcessor.cs:line 139 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NConsole.CommandLineProcessor.<ProcessAsync>d__11.MoveNext() in C:\projects\nconsole\src\NConsole\CommandLineProcessor.cs:line 107 --- End of inner exception stack trace --- at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification) at NSwag.Commands.NSwagCommandProcessor.Process(String[] args) in C:\Data\Projects\NSwag\src\NSwag.Commands\NSwagCommandProcessor.cs:line 59 ---> (Inner Exception #0) System.InvalidOperationException: Sequence contains more than one matching element at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func
2 predicate) at NSwag.CodeGeneration.TypeScript.Templates.RequestBodyTemplate.TransformText() in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration.TypeScript\Templates\RequestBodyTemplate.tt:line 2 at NSwag.CodeGeneration.TypeScript.Templates.AngularClientTemplate.TransformText() in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration.TypeScript\Templates\AngularClientTemplate.tt:line 50 at NSwag.CodeGeneration.TypeScript.Templates.AngularClientTemplate.Render() in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration.TypeScript\Templates\AngularClientTemplate.Extensions.cs:line 18 at NSwag.CodeGeneration.ClientGeneratorBase`3.GenerateFile(SwaggerDocument document, ClientGeneratorOutputType type) in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration\ClientGeneratorBase.cs:line 90 at NSwag.Commands.SwaggerToTypeScriptClientCommand.< -
0
You made sure the Web API is working fine and no problems with the logic / db access?
-
0
Hi @omkarchoudhari,
Did you recently added a new app service or method to an app service ? It seems like there are more than one method with same signature.
Thanks.