-
Hi! I'm wondering if YARP enables easier binding to hostnames during development of ASP.NET Core apps on Windows? For example, during development I would like my application to be reachable via https://dev.mysite.localhost. Currently, I'm aware of these options:
What I really want: Solution 3., but without the need for IIS :) Can YARP help with this? I understand that at some point, admin privileges are needed, because otherwise the app won't be able to bind to port 443... some way to interface with http.sys would be needed. Maybe there is a simpler solution that I'm not aware of at the moment, so I would greatly appreciate any pointers in the right direction - Thanks! EDIT: Why do I want this in the first place? Mostly for enabling easier handling of OAUTH redirect URLs, especially in cases where I'm not able to configure them myself. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
Note YARP plugs into the existing APS.NET Core routing system, it does not change anything about the existing server binding behaviors. Have you considered using Kestrel instead of IIS? It registers by IP and port, not host names, and those can be configured programatically. Your main conflict would be port 443, but for development you should be able to use alternate ports? |
Beta Was this translation helpful? Give feedback.
-
I regularly use Kestrel directly (or IIS Express), bound to port + IP. It is actually my preferred approach with most projects, as it involves no extra setup 😊 But it would be nice to be able to use custom hostnames during development in some cases. As I mentioned above, being able to use 'proper' hostnames for redirect URIs (e.g., when interfacing with an Azure B2C instance managed by a client) just feels nicer. It is in no way a deal breaker, as there are plenty of workarounds and solutions. I just want to make sure that I'm not overlooking some obvious and easy option. |
Beta Was this translation helpful? Give feedback.
-
You can cheat and add hostname entries directly to the etc/hosts file on both linux and windows. They will be resolved without DNS lookups. |
Beta Was this translation helpful? Give feedback.
-
Thanks for all your input - I guess there is currently no 'ideal' solution for my scenario. The IISAdministration cmdlets already enable the configuration of IIS through the CLI, so I guess in the end there is no real need for yet another product. But a uniform, cross-platform experience sure would be nice. |
Beta Was this translation helpful? Give feedback.
Thanks for all your input - I guess there is currently no 'ideal' solution for my scenario.
After thinking about the suggestions, I came to the realization that what I really want is a IIS-esque product that is tightly integrated with the ASP.NET Core ecosystem... Maybe a global tool that allows for commands àla:
dotnet hosting site add --name "MySite" --path "C:\inetpub\mysite"
and
dotnet hosting binding add --site "MySite" --hostname "https://dev.mysite.localhost" --type https --cert-thumbprint 1128a412342170694be96cb987c5c93af063d1c7
...or something along these lines.
The IISAdministration cmdlets already enable the configuration of IIS through the CLI, so I guess in the end there is no …