0

I create a service in wcf with this contract :

namespace CMSManagement.Domain.Repository
{
    [ServiceContract]
    public interface IRepository<TEntity> where TEntity:class
    {

        [OperationContract]
        TEntity FindById(Guid id);

        [OperationContract]
        bool Add(TEntity entity);

        [OperationContract]
        bool Remove(TEntity entity);

        [OperationContract]
        bool Edit(TEntity entity);

        [OperationContract]
        bool Save();

        [OperationContract]
        IQueryable<TEntity> Get();

    }
}

I want to add this to webconfig : enter image description here

 <endpoint address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="secureHttpBinding"
                  contract="CMSManagement.Domain.Repository.IRepository"/>

But the webconfig can't find this interface why ?

Ehsan Akbar
  • 6,977
  • 19
  • 96
  • 180

1 Answers1

0

you can try below code in case of generic interface

<service name="Namespace.Service, AssemblyName">
    <endpoint 
        address="" 
        binding="webHttpBinding" 
        behaviorConfiguration="webHttpBehavior"
        contract="Namespace.IService`1[[Namespace.Class1, AssemblyName]], AssemblyName"  />
</service>

<behavior name="webHttpBehavior">
    <enableWebScript />
</behavior> 

Possibly the same question at GenericInterfaceWCF

Community
  • 1
  • 1
Nomi Ali
  • 2,165
  • 3
  • 27
  • 48
  • contract="CMSManagement.Domain.Repository.IRepository`1[[CMSManagement.Domain.Entity.FileManagement, CMSManagement.Domain]], CMSManagement.Domain" />---But same problem – Ehsan Akbar May 21 '17 at 11:37
  • try like mscorlib, contract="CMSManagement.Domain.Repository.IRepository`1[[CMS‌​Management.Domain.En‌​tity.FileManagement]], mscorlib" /> – Nomi Ali May 21 '17 at 11:47
  • it should work, https://weblogs.asp.net/zareian/how-to-write-a-generic-service-in-wcf – Nomi Ali May 21 '17 at 11:50