Swashbuckle.webapi: Get 404 error when trying to customize the UI

Created on 18 Aug 2016  路  12Comments  路  Source: domaindrivendev/Swashbuckle.WebApi

I'm using the sample index.html and change the url to my url. But got the following errors:

Failed to load resource: the server responded with a status of 404 (Not Found)

For all the files in lib. What could be the reason? Thanks.

Most helpful comment

What is solution for that?

All 12 comments

The full error message is:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:53670/swagger/ui/lib/underscore-min-js

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:53670/swagger/ui/lib/handlebars-2-0-0-js

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:53670/swagger/ui/lib/underscore-min-js

Failed to load resource: the server responded with a status of 404 (Not Found) backbone-min-js:3 Uncaught TypeError: Cannot read property 'each' of undefined swagger-ui-js:9

Uncaught ReferenceError: Handlebars is not defined http://localhost:53670/swagger/ui/lib/highlight-7-3-pack-js Failed to load resource: the server responded with a status of 404 (Not Found) index:54

Uncaught ReferenceError: SwaggerUi is not defined

Look through the source code. I'm wondering where all the js files are?

swagger-ui is a git submodule. You need to run "git submodule update" from solution root

Are u using a custom index.html? If so, you'll need to base it off this one (note the dots in the names replaced by dashes) - https://github.com/domaindrivendev/Swashbuckle/blob/master/Swashbuckle.Core/SwaggerUi/CustomAssets/index.html

Yes, I'm using this one.

But where should I use git submodule update. I install the swashbuckle through NuGet Package Manager.

I check the original index.html, it looks very similar to this one. But it works well.

@domaindrivendev This index.html works. The one I used is:

https://github.com/domaindrivendev/Swashbuckle/blob/v5.2.1/Swashbuckle.Core/SwaggerUi/CustomAssets/index.html

So the document is wrong.

Another thing is the string will be encoded if I add an api_key(token). For example, if I add a token bearer 12343314134134, it will become bearer%2012343314134134. This will cause problem. How can I fix it? Thanks.

How can I add an asset file and referred by my index.html? For example, I add a logo.png to the same folder as the index.html. But it doesn't work when I refer to it loke <img src="logo.png">.

I think you can try inject stylesheet or javascript to make the change.

Solved the issue already.

What is solution for that?

@zh-wowtv what was the solution?

The custom index.html i still causing issues till date. I think the link should be changed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raaga123 picture raaga123  路  4Comments

kmmacgill picture kmmacgill  路  3Comments

kongres picture kongres  路  4Comments

johnpmcclung picture johnpmcclung  路  3Comments

niemyjski picture niemyjski  路  3Comments