簡體   English   中英

如何使Swashbuckle / Swagger在Mono(.NET)框架上工作?

[英]How to get Swashbuckle / Swagger working on the Mono (.NET) Framework?

在MonoDevelop中,我啟動了一個新的WebApi項目。 WebApi應用程序按預期運行。 除了默認的WebApi項目外,我還添加了Swashbuckle / Swagger用於自動生成API文檔。 當我導航到swagger( http:// localhost / swagger )時,發生了404錯誤。 在文檔中,我發現我需要向Web.Config添加一些配置行。

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true">
</modules>

https://github.com/domaindrivendev/Swashbuckle/blob/master/README.md#page-not-found-when-accessing-the-ui

更改之后,沒有任何變化。 該項目正在Mono XSP4 Web服務器上運行。 有誰知道如何解決這個問題?

非常感謝,喬迪

找到了解決方案:

https://github.com/domaindrivendev/Swashbuckle/issues/555#issuecomment-153493068

將以下行添加到您的Web.Config文件。

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM