Back from my weekend and went to debug my web project which is an ASP.NET Core Web Api. It started giving me an error: Invalid URI: The hostname could not be parsed.
I can start a new asp.net core web api project and it debugs fine so I'm pretty sure its something with my configuration for this project. Any ideas?
James
Jakub's answer does fix the issue because it causes Visual Studio to regenerate applicationhost.config. In my case, the error was saying that the value of the
<binding>
tag could not be parsed. I had the following:<binding protocol="http" bindingInformation="*:5000:*" />
which when regenerated looked like this:<binding protocol="http" bindingInformation="*:5000:localhost" />
The file is found inside the ".vs" folder's "config" subfolder, and instead of deleting the whole directory, you can just fix/restore your<binding>
tag to a value that can be parsed.I post this answer because many people found my comment useful. Thanks to @joshcomley for poking me.
Hopefully this answer will help someone:
.vs
(note, this folder has a hidden attribute, so File Explorer does not show it by default).vs/config/applicationhost.config
file<site name="<Your_Web_Site_Name>" ....
. You can have several elements like this. You need to pick one where<Your_Web_Site_Name>
matches the name of your site<site
element find a child element like:<binding protocol="http" bindingInformation=":8080:localhost" />
and replace it with:
<binding protocol="http" bindingInformation=":8080:" />
Notes:
Invalid URI: The hostname could not be parsed
.<binding protocol="http" bindingInformation="*:8080:*" />
. And doiisreset
after this change.I had the same issue. Just close VS, remove .vs folder, open project once again. Rebuild & Run. It should help.
This error indicates that your bindingInformation for the site is not in the correct format.
The value for bindingInformation consists of three parts.
Here are some formats of bindings and their result:
With all the above bindings, you can set the protocol to https to make your site accessible only through SSL.