如何让 Swashbuckle / Swagger 在 Mono (.NET) Framework 上工作?
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>
此更改后没有任何变化。该项目在 Mono XSP4 网络服务器上 运行。有谁知道如何解决这个问题?
非常感谢,
乔迪
找到解决方案:
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>
在 MonoDevelop 中,我开始了一个新的 WebApi 项目。 WebApi 应用程序按预期工作。除了默认的 WebApi 项目之外,我还添加了 Swashbuckle / Swagger 以自动生成 API 的文档。当我导航到 swagger (http://localhost/swagger) 时,发生了 404 错误。在我发现的文档中,我需要向 Web.Config.
添加一些配置行<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
此更改后没有任何变化。该项目在 Mono XSP4 网络服务器上 运行。有谁知道如何解决这个问题?
非常感谢, 乔迪
找到解决方案:
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>