Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The value is invalid according to its datatype 'clientcontracttype'

I am getting an error message saying:

The contract attribute is invalid. the value is invalid according to its datatype 'clientcontracttype'

Following is the endpoint configuration in web.config of this WCF application. I am using .NET Framework 4.5 and Visual Studio 2012. I have verified the contract OnlineReporting.Core.Contracts.IReportingInternalWcfPortal is already there.

<endpoint address="http://localhost:63817/ReportingInternalWcfPortal.svc" 
          binding="basicHttpBinding" 
          bindingConfiguration="BasicHttpBinding" 
          contract="OnlineReporting.Core.Contracts.IReportingInternalWcfPortal" 
          name="ReportingInternalPortal" />
like image 403
Nirman Avatar asked Mar 19 '13 10:03

Nirman


3 Answers

I see this question is pretty old and I don't know if you have found a solution by now, but just in case, this is what I have found will resolve:

1) In the Solution Explorer, under the Service References folder, right-click the service reference name with the issue and select 'Configure Service Reference'.

2) The Service Reference Settings window will appear. Uncheck the box labeled 'Reuse types in referenced assemblies' and click the OK button.

3) Rebuild the project.

After rebuilding, the warning should disappear.

like image 169
TK71 Avatar answered Nov 05 '22 10:11

TK71


I found this question looking for the same error on a web service project.

In my case this error happened when I forgot to add the [ServiceContract] attribute on the IServiceBase interface.

As soon as I added it in the error went away.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace MyService
{
    [ServiceContract]
    public interface IServiceBase
    {
        [OperationContract]
        IEnumerable<ListItem> GetListItems();

        [OperationContract]
        void SaveListItems(IEnumerable<ListItem> listItems);
    }
like image 28
OrangeKing89 Avatar answered Nov 05 '22 11:11

OrangeKing89


The same error occurs when you're missing a reference [in the project with the .config] to the actual project/library containing the interface/service contract...

like image 13
Vincent Van Den Berghe Avatar answered Nov 05 '22 10:11

Vincent Van Den Berghe