简体   繁体   English

是否可以使用 launchSettings.json 启用带有 IIS Express 的访问控制允许来源响应标头?

[英]Can launchSettings.json be used to enable access-control-allow-origin response headers with IIS Express?

I was hoping to be able to specify CORS related configuration for IIS Express within the launchSettings.json file of my ASP.NET Core application.我希望能够在我的 Z9E0DA8438E1E38A1065B2126Z Express 的 launchSettings.json 文件中为 IIS Express 指定 CORS 相关配置。 I've tried searching for examples, tutorials or documentation related to configuring IIS Express with launchSettings.json but so far have not had much luck with that.我已经尝试搜索与使用 launchSettings.json 配置 IIS Express 相关的示例、教程或文档,但到目前为止还没有太多运气。 This page shows how to configure IIS itself to specify response headers using xml: https://docs.microsoft.com/en-us/iis/extensions/cors-module/cors-module-configuration-reference .此页面显示如何配置 IIS 本身以使用 xml 指定响应标头: https://docs.microsoft.com/en-us/corscors/extensions My ASP.NET Core application targets .NET Core 2.1 currently.我的 ASP.NET Core 应用程序目前针对 .NET Core 2.1。 Thoughts?想法? I'm not sure if this is even possible or if I need to just use regular IIS instead of IIS Express.我不确定这是否可能,或者我是否需要使用常规 IIS 而不是 IIS Express。

No. launchSettings.json is only honored by dotnet run and other .NET Core tooling, not by IIS Express. launchSettings.json仅适用于dotnet run和其他 .NET 核心工具,而不适用于 IIS Express。

You can switch to full IIS for development, or use the CORS module for IIS upon IIS Express (the actual steps are too complicated without PowerShell scripts written by me ). You can switch to full IIS for development, or use the CORS module for IIS upon IIS Express (the actual steps are too complicated without PowerShell scripts written by me ).

暂无
暂无

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

相关问题 Visual Studio,每个开发人员launchSettings.json - Visual Studio, per developer launchSettings.json launchSettings.json 文件打开错误的 URL - launchSettings.json file opens wrong URL 根据构建配置选择launchSettings.json配置文件 - Choose launchSettings.json profile based on build configuration 在 Visual Studio 2017 中的 launchSettings.json 中手动定义端口 - Manually defining ports in launchSettings.json in Visual Studio 2017 启动配置文件初始值设定项:无法解析 launchSettings.json 文件 - Launch Profile Initializer: Unable to parse the launchSettings.json file 如何使用 VisualStudio docker 调试器(launchSettings.json 配置文件)从 Docker 容器公开自定义端口 (TCP)? - How to expose custom port (TCP) from Docker container using VisualStudio docker debugger (launchSettings.json profile)? Visual Studio在发布过程中使用launchSettings.json配置文件中定义的哪个? - Which of defined in launchSettings.json profiles Visual Studio uses during publication? 从 Visual Studio 2019 在 Kestrel 下运行 .NET 5 Api 会忽略 launchSettings.json applicationUrl 设置 - Running .NET 5 Api under Kestrel from Visual Studio 2019 ignores launchSettings.json applicationUrl setting 我应该忽略在 Git 中提交的 `launchSettings.json` 文件吗? - Should I ignore `launchSettings.json` file from being committed in Git? 如何防止在 Visual Studio 2017 中创建 launchSettings.json - How to prevent launchSettings.json from being created in Visual Studio 2017
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM