Skip to content

Angular boilerplate app - individual accounts authentication doesn't work in IIS #19852

Closed
@MiroKov

Description

@MiroKov

Hi,

I created a new AspNetCoreWebApplication with Angular in .net core 3.1 (individual accounts).

Without changing any code, I published the app in folder, and hosted it in IIS.
I changed the base href in index.html to /test/, and added the

"Key": { "Type": "Development" }

in app.production.json.

When starting the app in browser, I get the following error(s):

image

I have seen that the authorize.service uses

const response = await fetch(ApplicationPaths.ApiAuthorizationClientConfigurationUrl);

fetch command to get something from the server, but the fetch command will not use the base href from angular.

When I change the code to:

const response = await this.httpClient.get<Response>(ApplicationPaths.ApiAuthorizationClientConfigurationUrl).toPromise();

then I get an endless loop and it fails to work.

Changing the

image

links manually to have test/ in front doesn't help either, because then after

authorize?clientid=....

comes the

error?errorid=....

and then my angular app tries to route to test/home/error which fails.

I do not see how best to fix this. In IIS Express it runs without problems.

Any help is greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.help wantedUp for grabs. We would accept a PR to help resolve this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions