简体   繁体   中英

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. 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. 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 . My ASP.NET Core application targets .NET Core 2.1 currently. Thoughts? I'm not sure if this is even possible or if I need to just use regular IIS instead of IIS Express.

No. launchSettings.json is only honored by dotnet run and other .NET Core tooling, not by 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 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM