我们正在使用 .Net Core (3.1.1) API 和 React 前端开发一个应用程序。该应用程序使用 Windows 身份验证。我们正在运行依赖于 IIS 的 API 框架。我们最初遇到了 CORS 问题,但通过安装 CORS 模块并在部署时对 web.config 进行转换,让服务器上的 IIS 一切正常。<customheaders>通过向 Visual Studio 的 applicationhost.config 文件添加一个部分,我们还可以在 IIS Express 上运行基本的 CORS 。然而,当在 IIS Express 上本地运行时,我们陷入了 PUT 和 DELETE 操作的预检请求上。
这是我的 lauchSettings.json 文件:
{
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:xxxxx",
"sslPort": xxxxx
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"API": { …Run Code Online (Sandbox Code Playgroud)