【问题标题】:Contract could not be found in the list of contracts在合同列表中找不到合同
【发布时间】:2014-10-21 08:59:30
【问题描述】:

我有一个需要测试的项目,它是一项围绕合同构建的服务(我认为是 wcf??)。当我尝试启动它时,我收到以下错误消息:

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>

【问题讨论】:

标签: c# wcf service contract


【解决方案1】:

你能不能尝试在上面的代码中为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
    {

【讨论】:

    猜你喜欢
    • 2011-01-05
    • 1970-01-01
    • 2020-05-26
    • 1970-01-01
    • 2011-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-09
    相关资源
    最近更新 更多