Update your configuration to look like this:
<configuration> <system.web> <compilation debug="true" targetframework="4.0"> <authentication mode="None"> </authentication></compilation></system.web> <system.webserver> <modules runallmanagedmodulesforallrequests="true"> </modules></system.webserver> <system.servicemodel> <servicehostingenvironment **aspnetcompatibilityenabled**="true"> <standardendpoints> <webscriptendpoint> <standardendpoint **crossdomainscriptaccessenabled**="true" name=""> </standardendpoint></webscriptendpoint> </standardendpoints> </servicehostingenvironment></system.servicemodel> </configuration>
See here to post a blog post , giving a step-by-step guide on creating a wcf service available for a cross-domain.
This will allow your service to accept requests from cross-domain sources.
In terms of determining whether to defer your answer (p in jsonp),
Thanks @carlosfigueira for this:
When using .Net 4 JSONP is supported natively. As long as the request has a query string parameter called a callback (this name can be configured), the response will be supplemented by the name of the function,
Otherwise, you will need to write a special message inspector that will correctly answer the answer.
source share