Cross domain ajax and WCF -


is wcf allowing cross-domain ajax functionality?

i have wcf project (localhost:53763) , web application (localhost:50238) in c#. tried access wcf in web application ajax call. got error in console that

options localhost:53763/wcftest.svc/xml/1122 405 (method not allowed) jquery-1.9.1.min.js:5 xmlhttprequest cannot load localhost:53763/wcftest.svc/xml/1122. origin localhost:50238 not allowed access-control-allow-origin.

then tried added wcf project in iis. got error same above

options http://www.wcftest.com/wcftest.svc/xml/111 405 (method not allowed) jquery-1.9.1.min.js:5 xmlhttprequest cannot load http://www.wcftest.com/wcftest.svc/xml/111. origin localhost:50238 not allowed access-control-allow-origin.

you need implement line functions:

weboperationcontext.current.outgoingresponse.headers.add("access-control-allow-origin", "*"); 

there several options decorate every request, cannot find correct interface that.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -