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" />
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.
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);
}
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With