Skip to content

Using sub directory at launch url #1682

@techcap

Description

@techcap

I used launch url like this in launchSettings.json.

      "launchUrl": "http://localhost:5000/ns",

When I launch using kestrel, it says "the webpage cannot be found".

After changing MapRoute template like this, it works properly.

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "ns/{controller=Home}/{action=Index}/{id?}");
            });

Is it by design?
Is it any better idea avoiding using static string "ns/" in template?

When I use iis express, it becomes worse.

After changing applicationUrl for iisexpress like this and modifying MapRoute template, it works properly.

    "iisExpress": {
      "applicationUrl": "http://localhost:1495/ns/",
      "sslPort": 0
    }

But iis express works on root "/" not "/ns".

I changed applicationHost.config in .vs/config application path "/" to "/ns" like this.

            <site name="WebApplication32" id="2">
                <application path="/ns" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="d:\work\WebApplication32\src\WebApplication32" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:1495:localhost" />
                </bindings>
            </site>

After modifying the applicationHost.config, VS debugger shows the message box, "Unable to start process".

Is there any method that running web in sub directory using iis express?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions