Hi Team,
We’ve deployed a layered application using ABP. The frontend is implemented in Angular and both the Angular application and the HttpApi.Host (API backend) are hosted on IIS.
- The Angular frontend is hosted at:
client.StageDomain.com
- The API (HttpApi.Host) is hosted at:
client.StageDomain.com/api
After deploying the API under the /api
path on the same domain, we encountered the following issues:
- The template switcher is not working
- Change Password functionality fails
- Several other features are not working as expected, seemingly due to the
/api
path and the ServiceProxyScript not being loaded
We reviewed the ABP IIS Deployment documentation, but it appears the guidance assumes separate domains or subdomains for each app component.
5 Answer(s)
-
0
The issue is caused by the Angular frontend being hosted at the root (
client.StageDomain.com
) and the API (HttpApi.Host) being hosted under a sub-path (client.StageDomain.com/api
). ABP's ServiceProxyScript and other dynamic endpoints (like/Abp/ServiceProxyScript
and/Abp/ApplicationConfigurationScript
) are expected at the root of the API application, but when hosted under/api
, the Angular app tries to load them from/Abp/ServiceProxyScript
instead of/api/Abp/ServiceProxyScript
.This results in 404/500 errors and MIME type issues, as seen in your console logs, because the requests are routed incorrectly or the server returns an HTML error page instead of the expected JavaScript.
ABP's official documentation and templates assume that the API is either on a separate domain/subdomain or at the root of a site, not under a sub-path like
/api
. Hosting the API under a sub-path is not officially supported and leads to these issues.To resolve this:
- Host the API (HttpApi.Host) on a separate subdomain (e.g.,
api.StageDomain.com
) or at the root of a different site. - Update your Angular environment and appsettings.json to point to the correct API root URL.
- If you must use a sub-path, you would need to customize the Angular app and possibly the ABP backend to ensure all dynamic script and API URLs are prefixed with
/api
, but this is not recommended and not officially supported.
- Host the API (HttpApi.Host) on a separate subdomain (e.g.,
For more details, see the official IIS deployment documentation:
- https://abp.io/docs/commercial/latest/startup-templates/application/deployment-iis?UI=NG&DB=EF&Tiered=No
In summary: Move your API to a root or subdomain, not a sub-path, for full ABP functionality.
Sources:
- https://abp.io/docs/commercial/latest/startup-templates/application/deployment-iis?UI=NG&DB=EF&Tiered=No
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
-
0
Hi, do you have any specific configuration in your
web.config
file that causes this problem? (Also, please check: https://abp.io/docs/latest/solution-templates/layered-web-application/deployment/deployment-iis?UI=NG&DB=EF&Tiered=No#rewrite-for-getenvconfig) -
0
Hi EngincanV, thanks for reaching out. As I mentioned earlier, our application is .NET Core-based and uses appsettings.json for configuration. Our web.config is minimal and doesn’t include any specific context-related settings. The only notable difference compared to our local environment is that the SelfUrl and Authority in appsettings.json include an additional /api suffix, whereas the AngularUrl does not. This is the only configuration difference we've identified so far.
Maybe this helps as well, when I try to change the layout of the website, I get some unexpected results on the staging site. Interestingly, on the first refresh, the website loads normally.
-
0
hi
Can you try to add
UsePathBase("/api")
to your API website?app.UsePathBase("/api"); app.UseRouting();