1
 function SendEditCommand() { jQuery.ajax({ url: 'http://localhost:15478/Service.svc/GetTest', type: 'GET', contentType: "application/json; charset=utf-8", dataType: "json", success: function () { alert('success'); }, error: function(request, status, error) { alert(error); } }); } jQuery(document).ready(function () { SendEditCommand(); }); 
<configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <connectionStrings> <add name="Entities" connectionString="metadata=res://*/Data.TechieCMS.csdl|res://*/Data.TechieCMS.ssdl|res://*/Data.TechieCMS.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost\mssql2008;Initial Catalog=TechieCMS;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /> </connectionStrings> <system.serviceModel> <services> <service name="DefaultService" behaviorConfiguration="DefaultServiceBehavior"> <endpoint address="" binding="webHttpBinding" contract="Techie.CMS.Business.ContentProvider" behaviorConfiguration="DefaultEndpointBehavior" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <endpointBehaviors> <behavior name="DefaultEndpointBehavior"> <enableWebScript /> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior name="DefaultServiceBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel> </configuration> 
 [ServiceContract] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class ContentProvider { [OperationContract] [WebGet()] public string GetTest() { return "Test"; } } 
2
  • 1
    You sure the service is running at the location specified? Commented Apr 12, 2011 at 0:55
  • 1
    What does your global.asax look like? Commented Apr 12, 2011 at 0:56

2 Answers 2

1

Im guessing that it does not like the port within the URL. Everything else is correct. Are you using IE? Does it work with other browsers? Other people with the same problem have been using IE and it works on Firefox.

Perhaps try adding a data variable and changing it to POST? Some say that solves it.

Sign up to request clarification or add additional context in comments.

Comments

0

Thank you all for your answers, they were surely relevant and a piece to the of the puzzle. The key problem was <service name="DefaultService"... I thought this was just supposed to be a name that I choose. Found out that it has to be the fully qualified name of the class that implements the contract.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.