I have a an existing service like the below method:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
public class SomeService : ISomething
{
public SomeListResults SomeList(SomeParams someParams)
{
....
}
}
Is there a simple way to allow JSONP calls and also JSON at the same time (detect it). Is this native?
Update your config to look like:
See here for a blog post providing a walkthrough of creating a wcf service that’s accessible cross-domain.
This will enable your service to accept requests from cross-domain sources.
In terms of determining whether to pad your response (the p in jsonp),
Thanks to @carlosfigueira for this:
Otherwise, you’ll need to write a custom message inspector that pads the response appropriately.