Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up URL of ASP.NET Core Web Application in Visual Studio 2015

I've create a ASP.NET Core Web Application in Visual Studio 2015 named "HelloASPNETCore", with the default template which has one controller "Home" and several actions "Index", "Contact".....etc; now I want to launch it on IIS Express with the root URL as

http://localhost:29492/HelloASPNETCore

but the default URL that Visual Studio set up to me is

http://localhost:29492

In the classic ASP.NET MVC Web Application Project I just specified the Project URL in the Project Properties and it works, but it's not work on the ASP.NET Core Web Application Project. I input the URL http://localhost:29492/Home/Index on browser and got the correct content respond, but http://localhost:29492/HelloASPNETCore/Home/Index gave me the empty content, without any error information.

like image 851
Paul Ma Avatar asked Aug 03 '16 08:08

Paul Ma


People also ask

How do I change the Open URL in Visual Studio?

From the project properties (the screen with the vertical tabs, right-click the project in Solution Explorer and select Properties) select the "Web" tab and under Servers you'll have Local IIS selected. Check the "Override application root URL" box and change the port there.


1 Answers

In the properties folder you have the file launchSettings.json, where you can set some settings of your application.

You will find something like this :

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:52023/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "index",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "YOUR_PROJECT_NAMESPACE": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "http://localhost:52023/index",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}
like image 182
AdrienTorris Avatar answered Sep 20 '22 19:09

AdrienTorris