Using the Angular + .NET Core sample application. I have set up and deployed the server side, no issues. I am having trouble with the Angular client. It is working locally.
When I try to deploy Running 'ng build -prod' is giving me the error "Unknown option: '-d' ". I'm running powershell as Admin. I was able to build with 'ng build --prod' I followed all other directions exactly.
When I try to run it my browser just shows the spinning progress animation and I have the following error in the console:
SEC7120: [CORS] The origin 'https://[mycompnay]angulardemoclient.azurewebsites.net' did not find 'https://[mycompnay]angulardemoclient.azurewebsites.net' in the Access-Control-Allow-Origin response header for cross-origin resource at 'https://[mycompnay]angulardemo.azurewebsites.net/AbpUserConfiguration/GetAll?d=1XXXXXXXXXXX8'.
This is a simple, unmodified demo. The only changes are changes I made matching the setup and deployment guides. I did update appconfig.production.json with the same changes made to appconfig.json because it was referring to the localhost in the error above until I did that.
2 Answer(s)
-
0
I was able to get it working.
- I updated the appsettings.Product.json file in the server app
//"ClientRootAddress": "http://localhost:4200/", //"CorsOrigins": "http://localhost:9902", "ServerRootAddress": "https://[mycompany]angulardemo.azurewebsites.net", "ClientRootAddress": "https://[mycompany]angulardemoclient.azurewebsites.net", "CorsOrigins": "https://[mycompany]angulardemoclient.azurewebsites.net,https://[mycompany]angulardemo.azurewebsites.net"
- I added this to the Startup.cs in the services.AddCors section (because of .Net Core 2.2)
.SetIsOriginAllowed((host) => true)
-
0
@replink, I have to allow connections from Ionic apps and I too had to add the following line:
.SetIsOriginAllowed((host) => true)
Is there any reason we can not add this to Zero as a standard?