Forum Discussion

MarcelW's avatar
MarcelW
New Contributor
3 years ago

https://.../api/swagger.json : Could not load file or assembly Newtonsoft.Json Version=13.0.0.0

My Project (Azure Function App Core 3.1) cant load the swagger.json, because of a missing file.
In other Projects it works fine. I fear some conflicts with other packages.

I have installed the Nuget package direktly and it seems fine. When i start the project locally it shows three auto generated swagger endpoints:
https://.../api/swagger/ui

https://.../api/openapi/v2.json
https://.../api/swagger.json


If i call the ui, it builds up with an error:

 

Failed to load API definition.

Fetch error

Failed to fetch http://.../api/swagger.json

Fetch error

Possible mixed-content issue? The page was loaded over https:// but a http:// URL was specified. Check that you are not attempting to load mixed content.

When i call ..api/swagger.json directly it shows me:
Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.


Any Ideas why it cant find the Newtonsoft.Json lib? 

 

 

  • MarcelW's avatar
    MarcelW
    New Contributor

    Hey. After removing the Newtonsoft.Json Refrence from all of my Projects in the solution i am a step further.
    These Endpoints now working..
    https://.../api/openapi/v3.json
    https://.../api/swagger.json

    and showing me a valid json in browser 🙂

    But now i am facing the next problem. The UI still shows the same error.
    Clicking on the yellow "validate"-Button at the bottom right corner, gives another
    Error:

    {"schemaValidationMessages":[{"level":"error","message":"Can't read from file http://.../api/swagger.json"}]}