What is your product version? 9.0.1 What is your product type (Angular or MVC)? Angular (single solution) What is product framework type (.net framework or .net core)? ASP.NET CORE
Hi
Is there any step by step guide for publishing ASP.NET Core and Angular single solution to IIS? If not can guide me how to host API (.Net Core) and UI (Angular) on same site on iis?
What about "ServerRootAddress": "https://localhost:44301/", "ClientRootAddress": "http://localhost:4200/"
settings in appsetting.jso and etc...
Thanks.
6 Answer(s)
-
0
https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Deployment-Angular-Publish-IIS
-
0
I asked for ASP.NET Core and Angular single solution not seprated.
-
0
Hi,
For single solution
ServerRootAddress
andClientRootAddress
will be the same. Unfortunately we don't have a document right now. If you publish your app on Windows, it should work out of the box.We will create a document as well, please follow https://github.com/aspnetzero/aspnet-zero-core/issues/3501.
If you face any problems, please let us know.
-
0
Hi @ismcagdas,
tnx
-
0
Hi,
I tried these steps:
Configure Web.Host\appsettings.Staging.json as you said with same value like this:
{ "ConnectionStrings": { "Default": "Server=localhost; Database=xxxDb; User=xxx; Password=xxx;" }, "App": { "ServerRootAddress": "http://{TENANCY_NAME}.test.sitename.com/", "ClientRootAddress": "http://{TENANCY_NAME}.test.sitename.com/", "CorsOrigins": "http://test.sitename.com,http://*.test.sitename.com" } }
Run
dotnet publish --configuration Staging --output ../../Publish/SiteName /p:EnvironmentName=Staging
Create IIS web site with these bindings
test.sitename.com
and*.test.sitename.com
Copied all publish files to IIS site's physical path.
Then tried to visit test.sitename.com, I get this erorr Oops! You're lost. We can not find the page you're looking for.
Then tried to visit test.sitename.com/ui/login it loads api login pages. But i couldn't find a way to load ui.
I Change config like this:
{ "ConnectionStrings": { "Default": "Server=localhost; Database=xxxDb; User=xxx; Password=xxx;" }, "App": { "ServerRootAddress": "http://{TENANCY_NAME}.api.test.sitename.com/", "ClientRootAddress": "http://{TENANCY_NAME}.test.sitename.com/", "CorsOrigins": "http://test.sitename.com,http://*.test.sitename.com" } }
but result was same.
note: I can get things work with two IIS site one for UI and the other for api. But I think it shoud also work under one site.
-
0
Hi @bulutyonetim
I suggest you to create a single solution using the same project name. In that project, you will see a custom middleware code in Startup.cs.
This middleware redirects all not found request to index.html, so your Angular app will be runned in such cases. Place this code into your Statup.cs and also publish your Angular app and copy it's output to wwwroot folder of the published server side app.