I'm working on a very simple WCF service. At the beginning everything was fine, then I moved the service interface in a separated DLL file. Since that I got this error:
The contract name
x.y.IService
could not be found in the list of contracts implemented by the servicez.t.MyService
My config file looks like this:
<endpointBehaviors>
<behavior name="webHttpBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="z.t.MyService">
<endpoint address=""
binding="webHttpBinding"
behaviorConfig开发者_Go百科uration="webHttpBehavior"
contract="x.y.IService" />
</service>
</services>...
and my service looks like this:
using x.y;
namespace z.y
{
public class MyService : IService
{
}
}
Everything else but the service works fine with that namespace. Where am I wrong?
Thanks in advance.
Everything looks fine assuming the z.t.MyService is a typo. This is exactly what we do and everything works for our service.
Edit based on comments: Yes, the interface can be a generic, however you will need to define the type before using it in the service.
You can do the following
public interface IActualService : IService<MyService>
Then you just use IAcutalService as the interface for your service.
精彩评论