Starting with .NET Aspire preview 5, the app host will crash if an applicationUrl is configured with an unsecure transport (non-TLS http) protocol. This is a security feature to prevent accidental exposure of sensitive data. However, there are scenarios where you might need to allow unsecure transport. This article explains how to allow unsecure transport in .NET Aspire projects.
Symptoms
When you run a .NET Aspire project with an applicationUrl configured with an unsecure transport protocol, you might see the following error message:
Output
The 'applicationUrl' setting must be an https address unless the
'ASPIRE_ALLOW_UNSECURED_TRANSPORT' environment variable is set to true.
This configuration is commonly set in the launch profile.
How to allow unsecure transport
To allow an unsecure transport in .NET Aspire, set the ASPIRE_ALLOW_UNSECURED_TRANSPORT environment variable to true. This environment variable is used to control the behavior of the app host when an applicationUrl is configured with an insecure transport protocol:
Alternatively, you can control this via the launch profile as it exposes the ability to configure environment variables per profile. To do this, consider the following example settings in the launchSettings.json file:
The preceding example shows two profiles, https and http. The https profile is configured with a secure transport protocol, while the http profile is configured with an insecure transport protocol. The ASPIRE_ALLOW_UNSECURED_TRANSPORT environment variable is set to true in the http profile to allow unsecure transport.
Surađujte s nama na GitHubu
Izvor za ovaj sadržaj možete pronaći na GitHubu, gdje možete stvarati i pregledavati probleme i zahtjeve za povlačenjem. Dodatne informacije potražite u našem vodiču za suradnike.
Povratne informacije o proizvodu .NET Aspire
.NET Aspire je projekt otvorenog koda. Odaberite vezu za slanje povratnih informacija:
Pridružite se seriji susreta kako biste s kolegama programerima i stručnjacima izgradili skalabilna rješenja umjetne inteligencije temeljena na stvarnim slučajevima upotrebe.