wcf - VS2010,WCF 服务无法启动

标签 wcf visual-studio-2010

我将逐步完成到目前为止我所做的如下:

  • 创建空解决方案
  • 添加了一个网站 WCFService
  • 从网站
  • 中删除了 Service 和 IService
  • 在解决方案中添加了 WCF 服务库项目
  • 添加端点到 web.config
  • 在 app.config 中做了同样的事情
  • 在 Web 应用程序中添加了对服务库的引用
  • ctrl + F5
    9

  • 我收到以下错误:

    Server Error in '/WFLedger' Application. The type 'Services.WFLedger.WF_Ledger', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



    异常详情:

    System.InvalidOperationException: The type 'Services.WFLedger.WF_API_Ledger', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.



    源错误:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.



    堆栈跟踪:

    [InvalidOperationException: The type 'Services.WFLedger.WF_Ledger', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.]
    System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +654
    System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1439
    System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +45
    System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +647

    [ServiceActivationException: The service '/WFLedger/WF_Ledger.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'Services.WFAPILedger.WF_API_Ledger', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found..]
    System.Runtime.AsyncResult.End(IAsyncResult result) +437
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +188
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService) +230 System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +360
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +213 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +76



    这真的让我发疯!!!
    为什么我收到这个错误?
    如果您需要更多信息,请告诉我,以便我提供给您
    提前一百万感谢

    最佳答案

    查看网站项目中的 WF_Ledger.svc 文件。它应该只包含一行。会有包含“Services.WFAPILedger.WF_API_Ledger”的服务属性。 WCF 正在寻找“Services.WFAPILedger.WF_API_Ledger”类,但没有找到。命名空间和类名需要存在于网站项目中,或者在您尝试设置时作为引用。您需要编辑该 Service 属性以匹配 WCF 服务库项目中的服务实现类。

    关于wcf - VS2010,WCF 服务无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5897250/

    上一篇:shell - 获取 sed 错误

    下一篇:R:屏蔽函数

    相关文章:

    c# - 如何从 Controller 传递列表以查看并显示为表格

    visual-studio-2010 - Nunit 未在 Visual Studio Debug模式下运行 SetUp 方法

    visual-studio-2010 - 在Visual C++中比较图像和视频

    .net-3.5 - WCF 服务与 Windows 服务

    .net - WCF - 如果在客户端连接时关闭,则在 CloseTimeout 持续时间内关闭双工 ServiceHost block

    wcf - Entity Framework 4 POCO 的存储过程错误 - "The FunctionImport could not be found in the container"

    javascript - 这叫什么日期时间格式? "/Date(1565929330662)/"

    wcf - 如何为需要客户端身份验证证书的 Web 服务添加对 WCF 客户端的服务引用

    visual-studio-2010 - 为什么 VS 2010 ATL 简单对象向导不会在项目名称包含连字符时生成 .cpp/.h 文件?

    visual-studio-2010 - “Active (Debug)”与“Debug”