Issue with "launch URL" in launchsettings.json file of my ASP.Net Core project to create a REST API

Jonathan Manoharan 1 Reputation point
2021-09-21T12:43:33.64+00:00

I need to create a REST API simulating some typical bank operations. I have created an ASP.Net Core project and use a Code first approach with Entity Framework. I have successfully created the database and the REST CRUD functions.

I have two controllers in my project :- BankMembersController.cs and UserAccountsController.cs. I have attached the BankMembersController.cs file and launchSettings.json files.

In the launchSettings.json file, I have modified the "launchUrl" field to "api/bankMember" in the "profiles" and "Bank_Account" sections.

When I run the program using IIS Express and Google Chrome as the browser, a page renders with the following error information: for the URL https://localhost:44335/api/bankMember :-

Bad Request - Invalid Hostname
133983-launchsettings.txt133939-bankmemberscontroller.txt
HTTP Error 400. The request hostname is invalid.

I have tried varios combinations for the "launchUrl" field e.g. BankMember, bankMembers, but all with same error message.

Further there is a second Controller call UserAccountsController. That is not currently mentioned in the launchsettings.json file.

Any help much appreciated!

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,178 questions
Microsoft Partner Center API
Microsoft Partner Center API
Microsoft Partner Center: A Microsoft website for partners that provides access to product support, a partner community, and other partner services.API: A software intermediary that allows two applications to interact with each other.
316 questions
{count} votes