Swashbuckle + XmlComments 在本地工作,但在服务器上生成招摇失败
问题说明
我有一个 webapi 项目,我正在使用 swashbuckle 框架来清除 api 文档.
I have a webapi project, and I am utilizing the swashbuckle framework to flush out api documentation.
我已按照说明使用我的控制器和 DTO 构建文档 xml 文件,并且在本地运行良好.
I have followed the directions to build the documentation xml file with my controller and DTO's, and it all works great locally.
但是,在生成 swagger 文档时,会抛出 500 错误.我已经确认如果我删除我的 xml 注册行,就会生成并成功返回 swagger 文档.
However, when generating the swagger document, a 500 error is thrown. I have confirmed if i remove my xml registration line, the swagger doc is generated and returned successfully.
这是我的注册行:
GlobalConfiguration.Configuration.EnableSwagger(c =>
{
...
c.IncludeXmlComments($"{System.AppDomain.CurrentDomain.BaseDirectory}bin\Company.MyApp.xml");
...
更新:我做了一些额外的日志记录,虽然 IncludeXmlComments 的这个 lne 在启动时成功运行,但当我从服务器请求 swagger.json 文件时,我得到了一个 System.IO.FileNotFoundException: 找不到文件 'D:homesitewwwrootinMonetary.Scheduling.xml'
异常.当我使用 Kudu 工具查看这个目录时,我找不到这个文件.
Update: I did some additional logging, and while this lne for IncludeXmlComments runs through successfully on startup, when I request the swagger.json file from the server, I am getting a System.IO.FileNotFoundException: Could not find file 'D:homesitewwwrootinMonetary.Scheduling.xml'
exception. when I use the Kudu tools to look into this directory, I cannot find this file.
TL;DR:为什么这个文件在本地显示很好,但是当我使用 Kudu 或 Octopus nugget 包部署到 Azure 时,这个文件不存在?
TL;DR: Why is this file showing up fine locally, but when I deploy to Azure using Kudu or a Octopus nugget package, this file is not there?
正确答案
问题是 XML 文件以某种方式无法发送到您的服务器...我在 Azure 部署中遇到了这个确切的问题,它在我的本地机器上运行良好,但在 azure 中却没有
The problem is that somehow the XML file is not making it to your server... I had this exact issue with an Azure deployment it worked fine in my local machine but not in azure
...这是因为我在发布配置中缺少 XML 文档
...and it was because I was missing the XML doc in the release config
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfkbbc
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20