Question

I have created a blank web application and added an ajax enabled wcf service. I have not modified the actual svc.cs file I am using what was provided by the template

namespace SP.WebWCF {
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ActivateCardV1 {
    // To use HTTP GET, add [WebGet] attribute. (Default ResponseFormat is WebMessageFormat.Json)
    // To create an operation that returns XML,
    //     add [WebGet(ResponseFormat=WebMessageFormat.Xml)],
    //     and include the following line in the operation body:
    //         WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml";
    [OperationContract]
    public void DoWork() {
        // Add your operation implementation here
        return;
    }

    // Add more operations here and mark them with [OperationContract]
}

}

I have updated the config slightly to look like this

 <service name="SP.WebWCF.ActivateCardV1">
    <endpoint address="https://services.mydomain.com" behaviorConfiguration="SP.WebWCF.ActivateCardV1AspNetAjaxBehavior"
      binding="webHttpBinding" contract="SP.WebWCF.ActivateCardV1" listenUri="/" isSystemEndpoint="true" />
  </service>

However when I try hit the service I get an error

Service 'SP.WebWCF.ActivateCardV1' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

WHat am I doing wrong?

Was it helpful?

Solution

Start by simplifying and standardizing your service configuration xml:

  1. Use wsHttpBinding.
  2. Use http instead of https.
  3. Remove ListenUri and isSystemEndpoint
  4. Remove the behavior configuration attribute.
  5. Add the contract name to the path.

Also remove (Namespace = "") from the ContractAttribute in your class - I'm not sure what that does but you are specifying the Namespace in the contract attribute of the configuration xml.

Once you've simplified your configuration it should look something like this:

<service name="SP.WebWCF.ActivateCardV1">
    <endpoint address="http://services.mydomain.com/ActivateCardV1" binding="wsHttpBinding" contract="SP.WebWCF.ActivateCardV1"/>
</service>

If it works, you can start adding complexity back to it to find out what breaks it. If it doesn't work it should be easier to troubleshoot (are any errors written to the IIS logs?).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top