vendredi 10 mai 2019

Failed to load resource when using virtual path in IIS? (C# .NET Core + Angular 7)

I have a web project which has a C# .NET Core backend and in the wwwroot directory the built Angular 7 project.

When I make a separate web site for this project in IIS it's works (assuming I add the localhost <> into hosts file).

Now, I should deploy my project as an application in the Default Web Site with the default application pool.

I added a the project as virtual folder then converted it into an application.

The url in the browser: localhost/mywebsite/

I just got a white, blank screen. The backend works and running, I tested it in Advanced Rest Client, however the frontend got problems with the virtual "/mywebsite" path.

"Failed to load resource: the server responded with a status of 404 (Not Found)"

All of the *.js files in the wwwroot got this problem, and the css ones too.

I tried the localhost url:

"http://localhost/somejsfile.<>.js"

...and it doesn't work, BUT when I add the virtual path this way:

"http://localhost/mywebsite/somejsfile.<>.js"

I got my js file.

I'm sure I'm missing something obvious, because this just cannot be so complicated to solve... I don't know how to make the Angular app ignore this virtual stuff or make the IIS do not break the application with it.

Thanks for the help and advices :)




Aucun commentaire:

Enregistrer un commentaire