Credit to Pranay Rana for this example:
http://www.codeproject.com/Articles/223572/Calling-Cross-Domain-WCF-service-using-Jquery-Java
Having an issue where it fails here with link to actual WCF:
http://jsfiddle.net/TyrHW/
Markup:
<%@ ServiceHost Language="C#" Debug="true" Service="WCF1.Service1" CodeBehind="Service1.svc.cs" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory"%>
C# WCF Service
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
namespace WCF1
{
[DataContract]
public class Customer
{
[DataMember]
public string Name;
[DataMember]
public string Address;
}
[ServiceContract(Namespace = "JsonpAjaxService")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1
{
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public Customer GetCustomer()
{
return new Customer() { Name = "Jacob Pines", Address = "999 S William St." };
}
}
}
web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel >
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<standardEndpoints>
<webScriptEndpoint>
<standardEndpoint name="" crossDomainScriptAccessEnabled="true"/>
</webScriptEndpoint>
</standardEndpoints>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
I get the same result locally as in my godaddy .net 4.0 host. I’ve checked asp.net levels. IIS security at goddady is set to annonymous. If I enter the url to the Service in a browser I get some apparent issue with authentication which I’ve sent to Godaddy. If I do the same locally, I get what appears to healthy Web Service, though still get undefined from jsFiddle.
It’s all new to me .. so It’s been a mission.
Thanks.
Quote from the following article:
In your case replace Integrated Windows Authentication with Basic Authentication.