Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Swagger on aspnetcore 2.0 not working

$
0
0

Trying to get SOME kind of swagger tooling working with my WEBAPI on ASPNETCORE 2.0 but having a lot of trouble...

So I went back to an empty project and following the workflow here (https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger?view=aspnetcore-2.0) I still can't get it going... any thoughts?

Is this supposed to work OOTB with aspnetcore 2.0? [VS2017 -> new WebAPI, no auth, -> Install-package  as per above -> runs through "Get packages" and hten gets to about 1 mins of installing things then dies with this last message...

Microsoft.Extensions.WebEncoders 1.0.3 depends on Microsoft.Extensions.Localization.Abstractions (>= 1.0.2) but Microsoft.Extensions.Localization.Abstractions 1.0.2 was not found. An approximate best match of Microsoft.Extensions.Localization.Abstractions 1.0.3 was resolved.

Install-Package : Package restore failed. Rolling back package changes for 'webapi'.At line:1 char:1

+ Install-Package Swashbuckle.AspNetCore

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception

    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

 

tried same with NSwag.AspNetCore and got similar but different (as per their instructions for manually installing the Microsoft.AspNetCore.StaticFiles package, this gives "versin conflicts")

  GET https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Extensions.DependencyInjection.Abstractions'

  OK https://www.nuget.org/api/v2/package/Microsoft.AspNetCore.Http.Extensions/1.0.3 1328ms

Install-Package : Unable to find package 'Nswag.AspNetCore' at source ''.At line:1 char:1

+ Install-Package Nswag.AspNetCore

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception

    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

]

UPDATE:

Can't delete this but I'm now unblocked.
For anyones assistance this is what was going wrong:

Windows7 in corporate environment doesn't refresh cached credentials stored in the Credential Manager (konwn issue resolved in win10 apparently?)

Anyway password changed today, workflow to resolve is apparently this:

Control Panel> User Accounts > Credential Manager --> under Generic Credentials remove the "VS_..." something Credential that is created when you get prompted in VS package manager (for example)

Close everything and restart (sheesh)

Open Visual Studio and try again and it should work/prompt for new credentails...

For other struggling with NSwag, this is the correct process with ASpnetcore 2.0 apparently (while it tells you here: its not very clear, IMO, what's actually required, so... in the spirit of being a little more explicit). This works in a "vanilla webapi netcore 2.0" project

install-package microsoft.aspnetcore.staticfiles
install-package nswag.aspnetcore


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>