【问题标题】:The Service attribute value in the ServiceHost directive cannot be found找不到 ServiceHost 指令中的 Service 属性值
【发布时间】:2013-12-28 22:54:16
【问题描述】:

好的,我花了一天时间查看这个错误和所有帖子,但我似乎仍然无法找到我哪里出错了。我可以与来自外部 Web 服务客户端的 Web 服务查找进行通信,但我无法从 VS 或 IIS 中浏览 .svc 文件。我正在发布到 IIS 6 服务器 .NET 4.0 上的映射驱动器。

任何帮助将不胜感激。

Web.config

<services>
      <service name="BiteSizeLearningWS.TranscriptService">

        <endpoint address=""
                  binding="wsHttpBinding"
                  contract="BiteSizeLearningWS.iServiceInterface" />


      </service>
    </services>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
      </serviceHostingEnvironment>
      <standardEndpoints>
          <webHttpEndpoint>
              <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="false" defaultOutgoingResponseFormat="Json" faultExceptionEnabled="false"></standardEndpoint>
          </webHttpEndpoint>
      </standardEndpoints>
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

Service.svc

<%@ ServiceHost Service="BiteSizeLearningWS.TranscriptService" %>

IserviceInterface.cs

namespace BiteSizeLearningWS
{
    [ServiceContract]
    public interface iServiceInterface
    ...

【问题讨论】:

  • 你尝试将地址属性放在端点元素中?

标签: c# wcf


【解决方案1】:

解决了。我的错误是实现服务接口的类名与我的 svc 文件中的服务名不匹配。我没有意识到他们必须匹配。

即 我的服务名称是:

<%@ ServiceHost Service="BiteSizeLearningWS.TranscriptService" %>

但我的实现是:

public class TranscriptServiceLibrary : iServiceInterface

而不是

public class TranscriptService : iServiceInterface

对不起,各位。我显然没有包括每个人都需要确定问题的一个文件。感谢您的所有意见。

【讨论】:

  • 这个提示让我找到了解决方案,太好了!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-06
  • 2015-07-31
  • 1970-01-01
相关资源
最近更新 更多