Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

This is my first attempt at a ServiceApplication and I am very new with the idea. I was using the WingtipCalc example code found here http://msdn.microsoft.com/en-us/library/gg543112.aspx I had no problem getting the calculator functions to work, but then I tried to modify so it would receive a filepath rather then two ints and output the content of that file in a string as opposed to the sum or subtraction of the two ints (the file is an xml doc). I added the necessary methods which were basically modified versions of the Add and Subtract methods and it seemed to be running fine until it got the ExecuteOnChannel delegate. I received this error:

The message with Action 'http://tempuri.org/IWingtipCalcContract/ViewXdoc' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

Here is the method that threw it:

private void ExecuteOnChannel(string operationName, CodeToRunOnChannel codeBlock)
    {
        SPServiceLoadBalancerContext loadBalancerContext = _loadBalancer.BeginOperation();

        try
        {
            // get a channel to the service app endpoint
            IChannel channel = (IChannel)GetChannel(loadBalancerContext.EndpointAddress);
            try
            {
                // execute the code block
                codeBlock((IWingtipCalcContract)channel);
                channel.Close();
            }
            catch (TimeoutException)
            {
                loadBalancerContext.Status = SPServiceLoadBalancerStatus.Failed;
                throw;
            }
            catch (EndpointNotFoundException)
            {
                loadBalancerContext.Status = SPServiceLoadBalancerStatus.Failed;
                throw;
            }
            finally
            {
                if (channel.State != CommunicationState.Closed)
                    channel.Abort();
            }
        }
        finally
        {
            loadBalancerContext.EndOperation();
        }
    }

Specifically this line:

codeBlock((IWingtipCalcContract)channel);

I wish I could provide more info, but like I said I am very new to this. Any help would be appreciated. Thanks!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I deactivated the feature, retracted and removed the solution then rebooted my computer and it worked fine.

I believe what happened was the old service contract was still in the GAC. I had run the Service Application before adding the viewXdoc methods and it remnants of it were floating around somewhere inside SharePoint. After completely removing all instances of the old Service Application, I was able to re-run and have it work fine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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