1

I'm working on putting together a custom service application and I'm seeing the aforementioned error: "There is no default service endpoint for service application"

The full stack trace is below:

Microsoft.SharePoint.SPException: There is no default endpoint for this application.    
at Microsoft.SharePoint.SPConnectedServiceApplication.get_ApplicationAddresses()     
at Microsoft.SharePoint.SPServiceLoadBalancer.<get_EndpointAddresses>d__0.MoveNext()     
at Microsoft.SharePoint.SPRoundRobinServiceLoadBalancer.GetEndpoints(IEnumerable`1 applicationAddresses)     
at Microsoft.SharePoint.SPRoundRobinServiceLoadBalancer.BeginOperation()     
at My.Namespace.Config.Clients.ConfigurationServiceClient.ExecuteOnChannel(ExecuteOnChannelDelegate lambda)     
at My.Namespace.Config.Clients.ConfigurationServiceClient.GetDbConnectionString()     
at My.Namespace.UI.ConfigurationTest.ConfigurationTestUserControl.Page_Load(Object sender, EventArgs e)     
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)     
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)     
at System.Web.UI.Control.OnLoad(EventArgs e)     
at System.Web.UI.Control.LoadRecursive()     
at System.Web.UI.Control.AddedControl(Control control, Int32 index)     
at My.Namespace.UI.ConfigurationTest.ConfigurationTest.CreateChildControls()     
at System.Web.UI.Control.EnsureChildControls()     
at System.Web.UI.Control.PreRenderRecursiveInternal()     
at System.Web.UI.Control.PreRenderRecursiveInternal()     
at System.Web.UI.Control.PreRenderRecursiveInternal()     
at System.Web.UI.Control.PreRenderRecursiveInternal()     
at System.Web.UI.Control.PreRenderRecursiveInternal()     
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The error is originating from a web part which is calling through a WCF client to the service.

Here's the codebehind for the webpart (very basic; just for testing purposes):

namespace My.Namespace.UI.ConfigurationTest
{
    public partial class ConfigurationTestUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ConfigurationServiceClient client = new ConfigurationServiceClient(SPServiceContext.Current);

            string connectionString = client.GetDbConnectionString();

            _connectionString.Text = connectionString;
        }
    }
}

It just tests reading a value from the service application (a database connection string).

The relevant section of code where the error is being raised in the WCF client is below:

private void ExecuteOnChannel(ExecuteOnChannelDelegate lambda)
{
    if (lambda == null)
    {
        throw new ArgumentNullException("lambda");
    }

    ConfigurationServiceApplicationProxy proxy = 
        (ConfigurationServiceApplicationProxy) _context.GetDefaultProxy(typeof(ConfigurationServiceApplicationProxy));

    if (proxy == null)
    {
        throw new InvalidOperationException("The IC configuration proxy was not found.");
    }

    SPServiceLoadBalancer loadBalancer = proxy.LoadBalancer;

    if (loadBalancer == null)
    {
        throw new InvalidOperationException("Could not locate the load balancer");
    }

    SPServiceLoadBalancerContext loadBalancerContext = loadBalancer.BeginOperation();

    // ADDITIONAL CODE OMITTED...
}

It's exactly on the loadBalancer.BeginOperation() call.

Any ideas would be appreciated. Most searches turn up issues with WCF configuration, however, I'm not sure that this is the case here as it is being raised from SharePoint so it seems that there may be some key point I'm missing with regards to the service client/application and registering the endpoints.

The service is started in "Manage services on server", there is an instance in "Manage service applications", and there is a proxy associated with the web application under "Configure service application associations". Those settings seem to be all in order. Just trying to figure out where else I can look to try to troubleshoot this.

5 Answers 5

1

Didn't get notifications from StackExchange, but I resolved the issues -- it was a terribly dumb mistake on my part as I did not override and implement DefaultEndPointName in my service application (the class that inherits SPIisWebServiceApplication).

Indeed, it's one of those rare cases when the error message spells out the mistake in a literal sense.

I am currently inclined to think that this is due to poor API design. If the property must be overridden, then I'm not sure why it's not marked abstract in the base class -- SPIisWebServiceApplication -- which itself is abstract.

Apologies for the late feedback!

0

What does the web.config for the custom service application's WCF service look like? There should be such a file in the same folder that you push your service's WCF bits in, in the WebServices mapped folder.

Also - on a tangent - why are you calling from the web part into a WCF service into the service app (which is, itself, a WCF call)? Why not call the service app directly?

1
  • Greg (by the way, we've met before), my assumption is that calling into the service app adds a layer of scalability because of the round robin load balancer in the application proxy (I could be wrong because the documentation is murky). Calling it from the web part is just a simplistic example to test that everything works. Oct 11, 2011 at 20:34
0

I know from looking at your stack trace that it kind of feels like it isn't a WCF error, but based on how it used to work with MOSS you needed either have the default endpoint defined in the web.config of the web application calling the WCF service (the one hosting the web part) or build the service connection in code (generally using a helper method).

I haven't deployed a WCF service in a 2010 environment however.

0

Are you able to browse the endpoint from IIS manager? Go to IIS manager, and under the SharePoint Web Services site, expand application guid that contains your service.svc (you might have to expand a few and switch to "Content View" in order to be able to find it).

Once you have found it, right click the .svc and click Browse. It might not solve the problem, but at least it should give you an indication of whether your endpoint exists :-)

0

I had the same problem. The reason here was wrong check and type passed around in service class. So check the types and check the GUIDs on your classes.

    public Type[] GetApplicationTypes()
    {
        return new Type[] { typeof(XXXServiceApplication) };
    }

    public SPPersistedTypeDescription GetApplicationTypeDescription(Type serviceApplicationType)
    {
        if (serviceApplicationType != typeof(XXXServiceApplication))
            throw new NotSupportedException();

        return new SPPersistedTypeDescription("XXX service", "XXX service");
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.