在合同清单中找不到合同

时间:2014-10-21 08:59:31

标签: c# wcf service contract

我有一个我需要测试的项目,它是围绕合同建立的服务(我想是这样的)。当我尝试启动它时,我收到以下错误信息:

Error starting service: The contract name 'VMBRLight.VMBRService' could not be found in the list of contracts implemented by the service 'VMBRLight.VMBRService'.

我在哪里可以找到合作清单?

这是我认为相关的代码,服务的实现:

namespace VMBRLight
{
    [ServiceBehavior(Namespace = "", Name = "VMBRLight.VMBRService", InstanceContextMode = InstanceContextMode.Single,
        ConcurrencyMode = ConcurrencyMode.Multiple, ReleaseServiceInstanceOnTransactionComplete = false, IncludeExceptionDetailInFaults = false,
        MaxItemsInObjectGraph = 2147483647, TransactionIsolationLevel = IsolationLevel.RepeatableRead)]
    public class VMBRLightService : VMBRService
    {

配置

<service behaviorConfiguration="VMBRLightServiceBehavior" name="VMBRLight.VMBRLightService">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:5250/VMBRLightService" />
          </baseAddresses>
        </host>
        <endpoint address="" binding="basicHttpBinding" contract="VMBRLight.VMBRService" bindingConfiguration="WebBinding" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

1 个答案:

答案 0 :(得分:0)

您是否可以尝试在VMBRLightService类的上述代码中添加[Service Contract]属性

namespace VMBRLight
{
    [ServiceBehavior(Namespace = "", Name = "VMBRLight.VMBRService", InstanceContextMode = InstanceContextMode.Single,
        ConcurrencyMode = ConcurrencyMode.Multiple, ReleaseServiceInstanceOnTransactionComplete = false, IncludeExceptionDetailInFaults = false,
        MaxItemsInObjectGraph = 2147483647, TransactionIsolationLevel = IsolationLevel.RepeatableRead)]
   ***[ServiceContract]***
    public class VMBRLightService : VMBRService
    {