Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentException: Invalid destination prefix. (Parameter 'destinationPrefix') #2492

Closed
rubenc57 opened this issue May 7, 2024 · 3 comments
Labels
Type: Bug Something isn't working

Comments

@rubenc57
Copy link

rubenc57 commented May 7, 2024

Hello

I get this error after upgrading my webforms project, using .NET Upgrade Assistant

ArgumentException: Invalid destination prefix. (Parameter 'destinationPrefix')

WebApp .net framework 4.8
to
WebAppCore .net 8.0

Yarp.ReverseProxy 2.1.0

Can someone knows why?

Greetings
Ruben

@rubenc57 rubenc57 added the Type: Bug Something isn't working label May 7, 2024
@MihaZupan
Copy link
Member

The error indicates that the YARP configuration is incorrect - the destination wasn't configured with a proper address (e.g. it was an empty string).

Can you check that ProxyTo is configured correctly in your launchSettings.json / appsettings.json?
You can also print app.Configuration["ProxyTo"] to see what the value was set to at runtime.

@rubenc57
Copy link
Author

rubenc57 commented May 7, 2024

appsettings.json
...
"AllowedHosts": "*",
"ProxyTo": ""

program.cs
...
app.MapForwarder("/{**catch-all}", app.Configuration["ProxyTo"]).Add(static builder => ((RouteEndpointBuilder)builder).Order = int.MaxValue);


var men = app.Configuration["ProxyTo"];
returns an empty value.

@rubenc57
Copy link
Author

rubenc57 commented May 7, 2024

Ok

The problem was on the launchSettings.json file

The "ProxyTo" was not defined

Problem fixed

Thank you

@rubenc57 rubenc57 closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants