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 :
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="CMSManagement.Domain.Repository.IRepository"/>
But the webconfig can't find this interface why ?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.