Skip to content

Uncaught SyntaxError: Unexpected token '<' in Angular 7.3 and .net 8 Application #59169

@aboulenein-ibrahim

Description

@aboulenein-ibrahim

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I recently migrated Angular/.Net Application from .net core 2.1 to .net 8. The application runs fine in my debug mode. However, when I deployed the application to IIS, it bombs with the 'Uncaught SyntaxError: Unexpected token '<' error.As I compared the updated application behaviour to the current one, I see that the angular built JS scripts runtime*, pollyfills*, main* and scripts* are HTML files rather than JS files. These same files in the dist folder look as JS files upon inspection. What is the cause of this? I checked the pathing of the files and the it's same angular file structure in both apps.

Any lights shed on this is greatly appreciated.

Used dotnet publish command
Used VS 2022 publish command also to generate the deployment package to no avail.
Copied over dist folder with the dist folder in my machine.

Expected Behavior

Hosted Application deployed with either dotnet publish command or by using the publish command in VS 2022 to run properly as it does in debug mode on my development machine.

Steps To Reproduce

NA

Exceptions (if any)

Uncaught SyntaxError: Unexpected token '<'

.NET Version

.Net 8

Anything else?

Angular 7 for UI

Image
Image
Image
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.Status: Resolvedarea-blazorIncludes: Blazor, Razor Componentsquestion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions