Base solution for your next web application
Open Closed

"./angular/nswag/refresh.bat" Not working on my Aspnet Core angular project (MacOs) #7411


User avatar
0
gryphon644 created

Hi I'm trying to update to update service-proxies.ts by running ./angular/nswag/refresh.bat but this issue shows up

I'm working with the last version of ASP.NET Core Angular.

Can somebody help please?


17 Answer(s)
  • User Avatar
    1
    maliming created
    Support Team

    Try executing ./node_modules/.bin/nswag run in the nswag directory.

  • User Avatar
    0
    gryphon644 created

    Did ../node_modules/.bin/nswag run and got this error

    System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException: Connection refused
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       at System.Threading.Tasks.ValueTask`1.get_Result()
       at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Threading.Tasks.ValueTask`1.get_Result()
       at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
       at System.Threading.Tasks.ValueTask`1.get_Result()
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
       at CallSite.Target(Closure , CallSite , Object )
       at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
       at NJsonSchema.Infrastructure.DynamicApis.HttpGetAsync(String url)
       at NSwag.SwaggerDocument.FromUrlAsync(String url) in C:\projects\nswag\src\NSwag.Core\SwaggerDocument.cs:line 216
       at NSwag.Commands.OutputCommandBase.ReadSwaggerDocumentAsync(String input) in C:\projects\nswag\src\NSwag.Commands\Commands\OutputCommandBase.cs:line 36
       at NSwag.Commands.SwaggerGeneration.FromSwaggerCommand.RunAsync() in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\FromSwaggerCommand.cs:line 62
       at NSwag.Commands.SwaggerGeneration.FromSwaggerCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\FromSwaggerCommand.cs:line 53
       at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in C:\projects\nswag\src\NSwag.Commands\NSwagDocumentBase.cs:line 268
       at NSwag.Commands.NSwagDocument.ExecuteAsync() in C:\projects\nswag\src\NSwag.Commands\NSwagDocument.cs:line 81
       at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 77
       at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 43
       at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
       at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
       at NConsole.CommandLineProcessor.Process(String[] args, Object input)
       at NSwag.Commands.NSwagCommandProcessor.Process(String[] args) in C:\projects\nswag\src\NSwag.Commands\NSwagCommandProcessor.cs:line 54child_process.js:660
        throw err;
        ^
    
    Error: Command failed: dotnet "/Users/usr/Desktop/Projects/A365/angular/node_modules/nswag/bin/binaries/NetCore21/dotnet-nswag.dll" run
        at checkExecSyncError (child_process.js:621:11)
        at Object.execSync (child_process.js:657:15)
        at /Users/user/Desktop/Projects/A365/angular/node_modules/nswag/bin/nswag.js:67:11
        at ChildProcess.exithandler (child_process.js:286:7)
        at ChildProcess.emit (events.js:203:13)
        at maybeClose (internal/child_process.js:1021:16)
        at Socket.<anonymous> (internal/child_process.js:430:11)
        at Socket.emit (events.js:203:13)
        at Pipe.<anonymous> (net.js:588:12) {
      status: 255,
      signal: null,
      output: [ null, null, null ],
      pid: 19131,
      stdout: null,
      stderr: null
    
  • User Avatar
    1
    maliming created
    Support Team

    The premise is that you need to run the web.host project.

  • User Avatar
    0
    gryphon644 created

    The .web.host is actually up and running

  • User Avatar
    1
    maliming created
    Support Team

    Is the url of the web.host project http://localhost:22742?

    If not, please modify the corresponding url in the service.config.nswag file.

  • User Avatar
    0
    gryphon644 created

    Oh Yeah i was using the 5000 port. It worked but now i'm having this error after npm start

    
    ERROR in ./node_modules/primeng/components/chart/chart.js
    Module not found: Error: Can't resolve 'chart.js' in '/Users/user/Desktop/Projects/A365/angular/node_modules/primeng/components/chart'
    ** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **
    ℹ 「wdm」: Failed to compile.
    
    
  • User Avatar
    1
    maliming created
    Support Team

    see: https://support.aspnetzero.com/QA/Questions/7383

  • User Avatar
    0
    gryphon644 created

    Working Now. Thanks ;)

  • User Avatar
    0
    gryphon644 created

    Now my scaffolding is done, adding and deleting works fine but when i try to edit it gives me this error

  • User Avatar
    0
    maliming created
    Support Team

    Please check the error log of the backend.

  • User Avatar
    0
    gryphon644 created

    this is what it shows

  • User Avatar
    0
    maliming created
    Support Team

    see: https://support.aspnetzero.com/QA/Questions/7402#answer-6f1efed4-92bd-4756-f9c1-39ef4dcfeaec

  • User Avatar
    0
    gryphon644 created

    Is there any documentation specific to aspnetzero? i'm getting lost with this auto mapping

  • User Avatar
    1
    maliming created
    Support Team

    You can add missing type mappings based on AutoMapper's error message.

  • User Avatar
    0
    gryphon644 created

    From what i saw in the CustomDtoMapper i already have the mapping config

  • User Avatar
    1
    maliming created
    Support Team

    try: configuration.CreateMap<Group, CreateOrEditGroup>();

  • User Avatar
    1
    gryphon644 created

    It worked after adding .ReverseMap();

    Thanks