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

Building a weather service using minimal APIs - ERROR: A path base can only be configured using IApplicationBuilder.UsePathBase(). #49

Closed
ntsiatinis opened this issue Apr 27, 2022 · 3 comments

Comments

@ntsiatinis
Copy link

ntsiatinis commented Apr 27, 2022

Just came across the following issue on or around page 712 when building the minimal API web service.

Using VS Code, when following the instructions and then running the API I received the following error

Unhandled exception. System.InvalidOperationException: A path base can only be configured using IApplicationBuilder.UsePathBase(). at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.ParseAddress(String address, Boolean& https) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IEnumerable listenOptions, AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication application, CancellationToken cancellationToken) at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host) at Microsoft.AspNetCore.Builder.WebApplication.Run(String url)

Tweaking the launchSettings.json to

"applicationUrl": "https://localhost:5003/",
"launchUrl": "api/weather",

got around the issue and allowed the API to start up.

@markjprice
Copy link
Owner

Thanks, Nick. I have added an erratum for this issue:
https://github.com/markjprice/cs10dotnet6/blob/main/errata.md#page-712---building-a-weather-service-using-minimal-apis

@douglasg14b
Copy link

@markjprice That's a dead link....

@markjprice
Copy link
Owner

markjprice commented Jan 29, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants