0

We have an ASP.NET Core web application that uses Angular JS (1.5) on the client, and the controllers are just used for returning data. During development, IIS Express is used on the developers' machines, and in other environments, IIS is used. This has some implications:

  1. attribute needs to be different between the devs' and the other environments: on devs' it looks like this: <base href="/"> while on the others (running IIS) it looks like this (it includes the domain name): <base href="/DigitalRural/">
  2. Angular directives also need to include the domain name in the templateURL field in IIS while not in the local IIS Express machines.

So after deploying the app to some environment, we add the domain name to these locations.

Trying to solve this, I've tried to go the route of including the domain name during development time, so that both the base href attribute and the templateURL filed containing the domain name. But setting either the Launch URL or the App URL in IIS Express to this URL: http://localhost:60209/DigitalRural/ doesn't work. The browser can't find any file and the page is almost blank.

How do configure IIS Express to find the static files? They are all located under the wwwroot folder of the web app, which it finds if the URL is http://localhost:60209/, but can't find if the URL is http://localhost:60209/DigitalRural/

Thanks,
ashilon

ashilon
  • 1,791
  • 3
  • 24
  • 41
  • Possible duplicate of [Using Custom Domains With IIS Express](https://stackoverflow.com/questions/4709014/using-custom-domains-with-iis-express) – natemcmaster Jul 25 '17 at 16:00
  • You are confusing domain name with relative path. base tag with href is used to tell the browser that my base path is this so all the resource requests urls will include base href also. Could you please elaborate on how the IIS setup is done so that domain name becomes href. My guess is that IIS is setup as a proxy where www.example.com will be routed by proxy setup to http://iisserver/example . is this assumtion correct?\ – Rohith Jul 25 '17 at 18:10
  • I hope that I understood what you said. IIS is used as a reverse proxy in all of our environments, and we access our web app in each of them like so: https://qamachine/DigitalRural/, https://prodmachine/DigitalRural/ etc... now, without the base href tag in its index.html, the browser can't find any of the static files, so we add it manually every time we update a version. But during development, IIS Express is used, and I don't know if it's used as a reverse proxy or not, but it only works with base href="/" and not base href="/DigitalRural/ like in the other environenmts, we don't know why. – ashilon Jul 27 '17 at 05:16

0 Answers0