C# WebAPI 如何禁用 HTTPS 访问
要在 C# WebAPI 中禁用 HTTPS,你需要修改 WebAPI 的配置。以下是一种方法可以实现:
- 打开 WebAPI 项目的 Web.config 文件。
- 找到以下配置节点:
<system.web>
<httpRuntime targetFramework='4.5' />
</system.web>
- 将该节点替换为以下内容:
<system.web>
<httpRuntime targetFramework='4.5' />
<compilation debug='true' targetFramework='4.5' />
<authentication mode='None' />
<pages controlRenderingCompatibilityVersion='4.0' />
</system.web>
- 找到以下配置节点:
<system.webServer>
<modules>
<remove name='WebDAVModule' />
</modules>
</system.webServer>
- 将该节点替换为以下内容:
<system.webServer>
<modules runAllManagedModulesForAllRequests='true'>
<remove name='WebDAVModule' />
</modules>
</system.webServer>
- 保存并关闭 Web.config 文件。
通过上述更改,WebAPI 将不再使用 HTTPS,并且可以通过 HTTP 进行访问。
原文地址: https://www.cveoy.top/t/topic/yGY 著作权归作者所有。请勿转载和采集!