WCF Service, the type provided as the service attribute values…could not be found

后端 未结 14 1191
梦如初夏
梦如初夏 2020-12-24 11:44

When I right click on Eval.svc within Visual Studio 2012 and view in browser, I get the following -

The type \'EvalServiceLibary.Eval\',

14条回答
  •  庸人自扰
    2020-12-24 12:30

    This is an old bug, but I encountered it today on a web service which had barely been altered since being created via "New \ Project.."

    For me, this issue was caused by the "IService.cs" file containing the following:

    <%@ ServiceHost Language="C#" Debug="true" Service="JSONWebService.Service1.svc" CodeBehind="Service1.svc.cs" %>
    

    Notice the value in the Service attribute contains ".svc" at the end.

    This shouldn't be there.

    Removing those 4 characters resolved this issue.

    <%@ ServiceHost Language="C#" Debug="true" Service="JSONWebService.Service1" CodeBehind="Service1.svc.cs" %>
    

    Note that you need to open this file from outside of Visual Studio.

    Visual Studio shows one file, Service1.cs in the Solution Explorer, but that only lets you alter Service1.svc.cs, not the Service1.svc file.

提交回复
热议问题