简体   繁体   English

如何在 Windows 10 的 IIS 管理器上启用 CORS?

[英]How to enable CORS on IIS Manager of Windows 10?

I've created an HTTPS server using IIS Manager (Windows 10).我使用 IIS 管理器(Windows 10)创建了一个 HTTPS 服务器。 Now, I want this server to support CORS requests.现在,我希望这台服务器支持 CORS 请求。

I've read some information.我读过一些资料。 For example, this link says that I have to create a file web.config in the directory.例如,这个链接说我必须在目录中创建一个文件 web.config。 Unfortunately, it didn't work out.不幸的是,它没有成功。 This link says that I should edit some config files, but I don't find them on my machine. 这个链接说我应该编辑一些配置文件,但我在我的机器上找不到它们。

I had a similar issue recently.我最近遇到了类似的问题。 Most tutorial/documentation only suggests adding custom headers in the configuration.大多数教程/文档仅建议在配置中添加自定义标头。 But this does not tell IIS to handle the CORS Pre-flight request by itself.但这并不告诉 IIS 自己处理 CORS 预检请求。

To do so, you must install the CORS Module in IIS and add some configuration in the web.config file, as explained here: IIS CORS module Configuration Reference为此,您必须在 IIS 中安装CORS 模块并在 web.config 文件中添加一些配置,如下所述: IIS CORS 模块配置参考

I recently used this to Reverse Proxy to a REST API and handling the CORS only in IIS so that I don't have to rebuild my project to change CORS settings.我最近使用它来将代理反向到 REST API 并仅在 IIS 中处理 CORS,这样我就不必重建我的项目来更改 CORS 设置。

Try to add this into :尝试将其添加到:

    <system.webServer>
        <modules>
            <remove name="WebDAVModule" />
        </modules>
    </system.webServer>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows 10 中的 IIS 管理器 - IIS Manager in Windows 10 如何在 windows 10 上启用文件名中的非法字符? - How to enable illegal characters in filenames on windows 10? 如何在 Windows 10 开发者预览版中启用 Bash? - How to enable Bash in Windows 10 developer preview? 如何在Windows故障转移群集管理器2012中启用“持久模式”? - How to enable “persistent mode” in Windows failover cluster manager 2012? 如何在 Windows 上安装 OpenCV 并在不使用包管理器的情况下为 PyCharm 启用它 - How to install OpenCV on Windows and enable it for PyCharm without using the package manager 如何在没有 IIS 的情况下在 C# Windows 服务中启用远程通信? - How to enable remote communication in a C# Windows Service without IIS? 如何解决“任务管理器中的 Windows 10 磁盘使用率 100%”? - How to solve "Windows 10 Disk Usage 100 percent in Task manager"? 如何在Windows 10 UWP中为模板Gridview设置Visual State Manager? - How to set Visual State Manager for template Gridview in Windows 10 UWP? Windows 10任务管理器如何检测虚拟机? - How does Windows 10 task manager detect a virtual machine? 如何使用 Windows Server 2019 在 IIS 10 上托管 Node JS 应用程序 - How to host Node JS app on IIS 10 with Windows Server 2019
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM