2

I followed the instruction and added two files as "Embedded Resources" in my Swagger folder:

APIDemo
  |
  |------ Swagger
           |
           |----index.html
           |----style.css

My SwaggerConfig.cs:

 .EnableSwaggerUi(c =>
   {
    c.InjectStylesheet(thisAssembly, "APIDemo.Swagger.style.css");
    c.CustomAsset("index", thisAssembly, "APIDemo.Swagger.index.html");

But I got the following error messages when I run the project:

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

What could be the reason? Thanks.

Bagusflyer
  • 12,675
  • 21
  • 96
  • 179
  • 1
    Fixed the problem by using index.html in master branch. Then comes a new question. How to refer to other asset files, i.e., image files in my index.html? – Bagusflyer Aug 22 '16 at 09:09
  • 1
    You can just add files in your `Content` folder, and then point to it from your embedded `index.html` file. – Benjamin Soulier Sep 06 '16 at 12:30

0 Answers0