Invalid URI: Host could not be parsed - c#

I know this is an common issue, however, I've tried many solutions but still can't get it to work. I haven't changed anything in the project. Just left it for a while wile working on other things. Maybe a week or two.
When it Happens
When I run the project in both release and debug from visual studio.
What I've tried
Deleted \Documents\IISExpress\Config
Delete .vs
Updateding Visual Studio
Repairing Visual Studio
Changing Luanch Settings Port
lauchSettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50235",
"sslPort": 44351
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Marel.Lairage.Blazor": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": false,
"applicationUrl": "http://*:900",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Project
.NET 5
Is there any other definition I can add to help solve this issue?

Change applicationUrl from "http://*:900", to "http://localhost:900",
Make sure that the URLS for ASPNET.CORE is not ...*:PORT

Related

launchSettings.json file opens wrong URL

When I try I couldn't run this project in my computer today but my teammates can run at their own computer. By the way I can run other projects. My launchSettings file like this:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4321",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
//"launchUrl": "User",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Dashboard.WebAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "User",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
But when I run this project my url is opening as "https://localhost:4321/swagger/index.html".
I guess this problem is because this url is run as "https" but my applicationUrl is "http".
What could be the cause of this problem?
Edit:
My browser:
Either disable Https redirection in your Startup.cs/Program.cs depending whether you use .net5 or .net6 or put your sslPort value in launchSettings.json to a 4322 port (or some other of your choosing, just not any that are in use) and it'll work.
Edit:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4321","https://localhost:4322",
"sslPort": 4322
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
//"launchUrl": "User",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Dashboard.WebAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "User",
"applicationUrl": "http://localhost:5000","https://localhost:5001"
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
On the Visual Studio toolbar their is a dropdown that allows you to select which profile to run. I suspect you are running the IIS Express profile when you want to run the Dashboard.WebAPI profile. If you see "IIS Express" on your toolbar with a green arrow to the left of it then select the dropdown and choose Dashboard.WebAPI (see mocked up image below)

HTTP Error 500.30 - ANCM In-Process Start Failure - Production Environment

I was configuring my application for deployment. The first step I did was changing the environment from Development to Production and stumbled in this error. I noticed that I can launch my application only in the Development Environment. When I change them to Staging, Production I get the mentioned error. Also, I tried the solutions from this post, and still no success.
Here are the related configurations:
launchSettings.json
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:64845",
"sslPort": 44375
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
},
"BingoAPI": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
}
}
}
xx.csproj
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

.Net Core Project won't open browser by default

When debugging in VS 2019 the api url automatically opens which is different from the angular live url.
The angular live url is my actual complete application. Is there a way to open that url automatically when debugging?
I think you need to modify your json config a little bit. So when you use VS to run your code or using dotnet run command you will use port 59709 to run your app
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59709/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"ancmHostingModel": "InProcess"
},
"KaddaTechnologies": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:59709/"
}
}
}

Running ASP.NET Core Angular template on Kestrel server?

I am trying to run the ASP.NET Core angular template on a kestrel server. It works flawlessly on ASP.NET, but when I change in the launchsettings in Visual Studio from IIS Express to my project name, it opens a command window where I can see the log and everything, but the browser returns a 404 error. This is what my launchsettings look like:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59994/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Sankini": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Production": {
"commandName": "IISExpress"
}
}
}
What can I do to make sure it works?
You will want the IISExpress server to serve your Angular App.
The NameOfEnvironmentWhenAppRuns is the name you assign the run button. Like so.
So to answer your question the following will work.
"Sankini": {
"commandName": "IISExpress",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}

VS2017 Debug: no Launch URL setting

Project (full net461, core 1.1) converted from VS2015:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:17901/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WebApplication1": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Also no browsers opens automatically after F5. (But site opens when I go to url manually).
And I also cannot create not Core web project in 2017 to see how it works - VS just writes something about "failed to create project" in bottom line and empty solution explorer, only folder created, nothing in Output, nothing in devenv /Log C:/log.xml log.
To fix: enable "Azure App service Tools"

Categories