none
Enable Cross-Origin In WCF RRS feed

  • Question

  • Hello,

    I have created a WCF Service and Host is in IIS. when i consume service. Following Error Is displaying

    Cross-Origin is Disable. How can i enable it ?


    Prem Shah

    Sunday, April 12, 2015 8:23 AM

Answers

  • Hi Prem Shah,

    >>Cross-Origin is Disable. How can i enable it ?

    Based on your description, it seems that you have tried to consume WCF Service in a different domain. Are you using the WCF Rest Service? In my mind, if we try to request a resource on a page using javascript(call a WCF Rest service) that is located on another domain/port then the XMLHttpRequest object that is implemented in the browser will first try to discover if the cross-origin resource is prepared/allows to accept requests from the origin. If this preflight request succeeds then the real request will be fired. Or we will meet the error like "Cross-Origin is Disable".

    For the detailed information about how to enable the CORS in WCF, please try to refer to the following articles:
    #Enabling CORS in WCF:
    http://www.codeproject.com/Articles/845474/Enabling-CORS-in-WCF .
    #Implementing CORS support in WCF:
    https://code.msdn.microsoft.com/windowsdesktop/Implementing-CORS-support-c1f9cd4b .


    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, April 13, 2015 2:38 AM
    Moderator