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!

Developer technologies | ASP.NET | ASP.NET Core
Microsoft Partner Center API
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.