Swagger xml 注释没有显示在文档 UI 中,不确定我在这里遗漏了一些东西..至少有人告诉我这是一个错误
Step1:创建一个全新的 ASP.NET Web 应用程序 Web API 项目
Step2:创建Web API项目
步骤3:安装Swashbuckle 5.6.0 NuGet包
第四步:启用生成 XML 文档文件(项目属性 -> 构建)
步骤 5:更新 SwaggerConfig.cs 以包含 XmlComments
public static void Register()
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
GlobalConfiguration.Configuration.EnableSwagger(c =>
{
var xmlFile = "bin\\" + $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);
});
}
Run Code Online (Sandbox Code Playgroud)
Step6:向控制器添加XML注释
///<Summary>
/// Get these comments1
///</Summary>
public class ValuesController : ApiController
{
///<Summary>
/// Get these comments2
///</Summary>
public IEnumerable<string> Get()
{
return new string[] { …Run Code Online (Sandbox Code Playgroud) 奇怪的行为,我正在我的家庭服务器 PC 上配置 Kafka 代理,并尝试通过 wifi 从另一台计算机进行连接。使用以下命令在 9092 上打开防火墙端口
netsh advfirewall 防火墙添加规则名称 =“TCP 端口 9092”dir = 操作 = 允许协议 = TCP 本地端口 = 9092
但是,当我尝试使用 Test-NetConnection 测试端口连接时,它失败了。我无法连接到 Windows 防火墙设置中配置为打开的任何端口,不知道为什么。我在客户端和服务器上禁用了 ipv6
PS C:\Users\ram> Test-NetConnection 10.58.35.113 -Port 9092 -Verbose
WARNING: TCP connect to (10.58.35.113 : 9092) failed
VERBOSE: 113.35.58.10.in-addr.arpa
VERBOSE: 113.35.58.10.in-addr.arpa
VERBOSE: 113.35.58.10.in-addr.arpa
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = QueryIsolationType,'className'
= MSFT_NetAddressFilter,'namespaceName' = root\standardcimv2'.
VERBOSE: Operation 'Invoke CimMethod' complete.
ComputerName : 10.58.35.113
RemoteAddress : 10.58.35.113
RemotePort : 9092 …Run Code Online (Sandbox Code Playgroud)