C# Swagger問題記錄:
1、使用nginx代理時無法通路Swagger
修改檔案Web.config;在configuration節點下添加節點(暫未明白該配置項的作用)
<add key="aspnet:UseHostHeaderForRequestUrl" value="true"/>
2、使用nginx代理後出現 Can't read from server. It may not have the appropriate access-control-origin settings
修改檔案Web.config;在system.webServer節點下添加節點
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*"/>
<add name="Access-Control-Allow-Headers" value="Content-Type"/>
<add name="Access-Control-Allow-Methods" value="POST, GET, PUT, DELETE, OPTIONS"/>
</customHeaders>
</httpProtocol>