- IGenericService 驻留在名为:“ABC.Server.Common”(ABC.Server.Common.dll) 的程序集中
- MyType 驻留在名为:“ABC.Server.Modules.X”的程序集中 (ABC.Server.Modules.X.dll)
代码:
public class ABC.Server.Modules.XService :
ABC.Server.Common.IGenericService<ABC.Server.Module.X.MyType>
{
ABC.Server.Common.GenericResponse<ABC.Server.Module.X.MyType> DoFoo(ABC.Server.Common.GenericRequest<ABC.Server.Module.X.MyType> request)
{
//Do Stuff Here
}
}
精简代码:
public class XService :
IGenericService<MyType>
{
GenericResponse<MyType> DoFoo(GenericRequest<MyType> request)
{
//Do Stuff Here
}
}
Web.config:
我不使用 SVC 文件,而是在 Web.config 中处理了这些信息:
<add factory="System.ServiceModel.Activation.ServiceHostFactory"
relativeAddress="Services/X.svc"
service="ABC.Server.Modules.X.XService"/>
<service name="ABC.Server.Modules.X.XService"
behaviorConfiguration="StandardBehavior">
<endpoint bindingConfiguration="StandardBinding"
binding="basicHttpBinding"
contract="?" />
</service>
我在合同名称中输入了什么才能使其真正起作用?