When you execute your Web Api and at Swagger Page you can see Swagger error ‘Failed to load API definition’, you can’t really determine, where the error is. It is in one of the controllers. But do you want to check all of them?

Open a developer panel (Ctrl + Shift + I in Chrome). At the Console tab there will be something like ‘swagger-ui-bundle.js:2  GET://localhost:7186/swagger/v1/swagger.json 500 (Internal Server Error)', then double click to this link and Network tab will be opened. Then choose the line ‘swagger.json’, also double click and go to Response Tab. There you can see the description of the error.

Usually, this error is because you have to methods with the same routing.

You can easily fix it with [Route] for the method.


After that Restart and Swagger works.