Deploying Angular 9 .NET Core template in IIS - asp.net

I'm trying to deploy .net core app with Angular, a project I created from the template available in Visual Studio.
The application I have in IIS is set to run from the angular app
Now within the same application, I added api application which is pointing to the api folder:
While I'm able to access the angular app, when I'm trying to login by calling the controller in the .net core application I'm getting this error:
System.InvalidOperationException: The SPA default page middleware
could not return the default page '/index.html' because it was not
found, and no other middleware handled the request. Your application
is running in Production mode, so make sure it has been published, or
that you have built your SPA manually. Alternatively you may wish to
switch to the Development environment.
Previously, when I was working with angular and .net core I had one project in VS for the .net core app and one project for the angular app and they were running from different subdomains, for example app.mywebsite.com for the angular app and api.mywebsite.com for the .net core app and I didn't have issues.
I was hoping with the .net core / Angular template I'll be able to run both the app and the api from one project but I'm currently experiencing the issues I mentioned above.

Related

Using ABP Framework with Blazor Webassembly, how do I put Blazor and the API on the same site?

I am using ABP Framework 5.2.2 and created an application using the "blazor" (webassembly) template. This creates a HttpApi.Host application and a Blazor application that run on separate sites.
How can I serve the Blazor files and host the API from the same site?
This can be done with one of the standard templates in Visual Studio, but how do I do this in the ABP Framework?
I've tried adding the Blazor project as a dependency in the HttpApi.Host project and eventually can get the index page to load, but that's as far as it goes.
Thanks for the help

Deploy Angular as UI and Asp.Net to the same AppService Azure

I am trying to deploy Angular as UI and Asp.Net to the same app service in Azure. The issue is that the Angular project does not display on the website. I have already defined the Physical Path to the angular project but it displays this error on the website. If I am only deploying the Angular app it displays as it should on the website but as soon as I publish the Asp.Net application to it, it returns an error on the website.
Does anyone know how to solve this problem?
Before deploying the website, kindly configure the ISS (Internet Information Services) which is a dependency with angular applications.
To deploy the core .net application with Angular with some DB connect, follow the steps mentioned in the blog
Document Credit: Jason Watmore

How to deploy ASP.NET project with Angular 13 frontend to IIS?

I am trying to setup the solution for a web application which uses ASP.NET with .NET Framework 4.8 for the backend and Angular 13 for the frontend (we cannot use .NET Core or any newer version because some of the libraries we need to use are only available for .NET Framework).
In the solution, the angular project is in the same folder as the backend project (where the sln file is also located). Now, I created a publish profile for the backend project but it is not yet linked to the angular project in any way, so the output folder only contains the files for the backend. In addition to that, I built the angular frontend via ng build which generated all of the files I need for the frontend in the dist folder.
How can I deploy this to an IIS webserver so users can see and work with the angular frontend and all http requests to the backend are routed to the appropriate controller and action in my ASP.NET application? Are there any tutorials or instructions for this? So far, I was not able to find what I am looking for and I am very confused how I am supposed to make this work in IIS.

ASP.NET Core MVC and ReactJS - Sharing Authentication session

I am already having a react SPA which works with backend WebAPI.
Currently, I am making an ASP.NET Core MVC Project which has its own view pages, but needs to integrate this app in one page (I will integrate all WebAPI functions to this MVC app as well).
Since I am using Cookie based authentication on my ASP.NET Core App, I want my react app to share the same authentication session so that users doesn't need to login again.
Theoretically, everything should work well when I copy the compiled react JS files to my ASP.NET Core scripts folder and run it.
But, The challenge is debugging. When both apps works on different ports, the Authentication cookie is not shared, and my react app will not work (Both CORS and Authentication problem)
How can I run both apps on same port while development?

VS2017: multiple asp.net core projects debug

We are migrating our project www.SampleProject.com from VS2013 into VS2017, also considering upgrade into ASP.NET Core. Project has following structure:
some class library projects (BLL and DAL)
API (WebAPI2 project)
UI (asp.net project with NG 1.4 used)
During debug:
Primary start-up project is UI, starting on localhost:52000
Second start-up project is API, starting on localhost:52000/API/
Such configuration allows us to debug both projects simultaneously, which is handy.
Also, this separation allows us to deploy API as separate REST API service (api.SampleProject.com) and also use API internally for UI (app.SampleProject.com/api)
In production environment, 'internal API' is configured in IIS as nested application in UI project.
However, this is not working with ASP.NET Core and VS2017.
Is there any known way how to debug two ASP.NET Core projects on same port (as described above)?
Thanks a lot

Resources