Base solution for your next web application
Open Closed

Error on publishing the angular project on IIs #7354


User avatar
0
nathaliewehbe created

Hi,

I am trying to publish the angular project on IIS but i am facing problem with CORS policy.

ERROR: Access to XMLHttpRequest at 'http://localhost:8080/AbpUserConfiguration/GetAll?d=1563787668709' from origin 'http://localhost' has been blocked by CORS policy: Request header field abp.tenantid is not allowed by Access-Control-Allow-Headers in preflight response.

and my appsettings.Production.json is : "App": { "ServerRootAddress": "http://192.168.20.100:8080/", "ClientRootAddress": "http://192.168.20.100:80/", "CorsOrigins": "http://192.168.20.100:80" }

and I put in the web.config :

 <cors enabled="true"> <add origin="*" /></cors>

Any idea?


14 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    192.168.20.100 and localhost are not the same domain name.

    Try the following configuration

    "App": {
    "ServerRootAddress": "http://192.168.20.100:8080/",
    "ClientRootAddress": "http://192.168.20.100:80/",
    "CorsOrigins": "http://192.168.20.100:80,http://localhost:80"
    }
    
  • User Avatar
    0
    nathaliewehbe created

    I tried ,http://localhost:80 and still not working

  • User Avatar
    0
    nathaliewehbe created

    Still waiting for any help to fix the issue related to CORS policy plus I add the CORs extension to chrome but still I am facing this issue.

    hostDashboard:1 Access to XMLHttpRequest at 'http://localhost:8080/signalr/negotiate?enc_auth_token=wNYmO41%2F48SHNstaLVXxHCCre29BZQl1NhC6NM3R3rzpXtPQxVzH6jEzA%2FQhXFN5tu6Fk7pO53uppm1mVXMZgxbyRVz26dnepi%2FFyB6axBY%2B6gq1GL%2BuRQgoiFUCjRN2p8w6LevViwKlHyWZZJZO1DGVSjAi1m2U%2Bog9pkHw9%2FQR4Nl%2FDPnoP9JYDMpZ1zxx09u6s0GZ9%2FQ5Sjk%2BL0UfcSCbl38X8he5w9UIn%2FHvxh7ysM1CiPLsoOwtbiieSRVmrmt0JjnipAn4%2FK283F8GrGwzwgehWsqefmUnM0ckMwP9ZAdwQxWDhxv0IqNw4tDhwUYs%2F1SYdYozdNzgByhgNOBPzQDObNLlWc4vV5VMOibjSs1wzigC%2FQiAGPNUi%2FHGWxQBq9fDgoc03lqlvF0Cve8uJogCrQtGvhG16DIo02RmZyrqYPxLF7pb8CXd6ZP%2B92LIZHGsbGwUcAI7IzrWDL5O4udPgscUCWv%2Fo%2BT%2BIWLmlVK7sXoOqdD9PK7zZ32s6aTptX3jF9l39llSbwRpbS1%2FyBDrjDwKGU5W27rUWXiA3Qev%2FAGXE%2FRwOjBcDp%2BExyJKYhSLeDCWQ7qhkYeBcD%2F7dqeXesk98QRyO4oC9Rw3lWLFuJXy0YW7O%2FGswPaROF35MAu2VGdYVY2atCGg%2FLZkqa4FZIBHHYmaq2Yv5pZONV4Rjvi3CaP5YdFuCPy%2FStsguFO0oAcvmBeK7OARDn5%2BfSN8XW9KmG2TjCAGPYl0hcNZlm%2BE8fhgV5W%2Fb5H%2BMTpoAsa5ZNeKEiDKGtznBW9grHzKK7%2BEQBF4FnF%2BNJ%2FMbYOjiMoam0NntA9wCdcaRDPYadclKIlLPJpb9zk9uGgNueomoXK%2FQxVFB5fw1BXatsmqNX%2B6z403ClbP0KcqnFxm1d69ttaUngXD9jg4fiCEUmOxD6NPU5qsSLCDmaoNt1O%2FXpkuWMDEv7%2F8LcXJ2%2FOg5BgneTNTmbi3n0Po0%2B8usCqb5tiV1KoBSn46414%3D' from origin 'http://localhost' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

  • User Avatar
    0
    maliming created
    Support Team

    Hi Try removing the 80 port in CorsOrigins?

    80 is the default port and generally does not need to be explicitly specified.

  • User Avatar
    0
    nathaliewehbe created

    yes I try it even not working

  • User Avatar
    0
    maliming created
    Support Team

    Can I take a look at it remotely?

  • User Avatar
    0
    nathaliewehbe created

    yes using team viewer you mean?

  • User Avatar
    0
    maliming created
    Support Team

    Share your connection information to [email protected]

  • User Avatar
    0
    nathaliewehbe created

    I want to open a specific url " http://185.187.94.224:9999" to prevent blocking from cors policy how can I set it in

    appsettings.Production.json { "ConnectionStrings": { "Default": "Server=VM-SOFFA\SQLEXPRESS; Database=SoffaV2; User=nwe; Password=nwesoffa@123;" }, "App": { "ServerRootAddress": "http://localhost:8080/", "ClientRootAddress": "http://localhost:80/", "CorsOrigins": "http://localhost, http://185.187.94.224:9999" } } because its only working for localhost but I want the second url

  • User Avatar
    0
    nathaliewehbe created

    Any ideas?

  • User Avatar
    0
    maliming created
    Support Team

    hi nathaliewehhbe Share your teamviewer connection information to [email protected]

  • User Avatar
    0
    maliming created
    Support Team

    Solved by remote.

  • User Avatar
    0
    leonkosak created

    @maliming: What was wrong? I am calling angular application (ANZ) in iFrame from other application and currently I have CORS issues. Thank you.

  • User Avatar
    0
    maliming created
    Support Team

    hi leonkosak

    I can't remember the specific cause of the problem, you can open a new question and describe the problem you encountered in detail.