Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 类型';RestService.weddingservice';,在ServiceHost指令中找不到作为服务属性值提供的_Asp.net_Wcf - Fatal编程技术网

Asp.net 类型';RestService.weddingservice';,在ServiceHost指令中找不到作为服务属性值提供的

Asp.net 类型';RestService.weddingservice';,在ServiceHost指令中找不到作为服务属性值提供的,asp.net,wcf,Asp.net,Wcf,我正在尝试创建我的第一个WCF restful服务。 在VS2010中,我打开weddingservice.svc,然后点击F5。浏览器将打开到 但这就是我得到的错误: Server Error in '/' Application. The type 'RestService.weddingservice', provided as the Service attribute value in the ServiceHost directive, or provided in the con

我正在尝试创建我的第一个WCF restful服务。 在VS2010中,我打开weddingservice.svc,然后点击F5。浏览器将打开到 但这就是我得到的错误:

Server Error in '/' Application.

The type 'RestService.weddingservice', 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. 

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

Source Error: 

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.

Stack Trace: 


[InvalidOperationException: The type 'RestService.weddingservice', 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) +51530
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1461
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +44
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +651

[ServiceActivationException: The service '/weddingservice.svc' cannot be activated due to an exception during compilation.  The exception message is: The type 'RestService.weddingservice', 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) +688590
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService) +234
   System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +359
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
在我的代码下面,我希望任何人都能看到我做错了什么。我没有使用正确的URI吗?我错过了什么

婚礼服务.svc

<%@ ServiceHost Language="VB" Debug="true" Service="RestService.weddingservice" CodeBehind="weddingservice.svc.vb" %>
web.config

<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  <services>
    <service name="weddingservice">
      <endpoint binding="webHttpBinding" contract="RestService.Iweddingservice" behaviorConfiguration="webHttp"/>
    </service>
  </services>
<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="webHttp">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
</behaviors>
</system.serviceModel>  

设置

<serviceDebug includeExceptionDetailInFaults="false" />


为了得到更多的细节


并尝试再次运行该流程

请从以下位置更改您的服务元素:

<service name="weddingservice">

致:



这应该可以解决您的问题

当我将Bin文件夹和obj文件夹手动添加到文件夹路径时,我的问题已经解决。我现在可以很好地访问它。

我最近重新配置了我的项目,遇到了这个错误


这是一个安装错误,发布网站时,我的服务DLL没有放在正确的目录中。

我也有同样的问题。只需删除bin和obj文件夹并重建即可解决此问题。

我的项目将dll构建到bin目录下的文件夹中,以匹配配置名称,因此如果项目名称为DemoWCF,配置为Debug,则dll将位于此处:

/bin/Debug/DemoWCF.dll
当我从输出路径中删除Debug/并在此处构建dll时:

/bin/DemoWCF.dll 
一切按预期进行


这是在输出路径的项目属性上的“生成”选项卡下配置的

我按照您所说的做了,并更新了错误…希望您能看到一些新内容:)1。单击工具菜单,然后单击“WCF服务配置编辑器”。2.编辑器打开后,关闭它。3.现在右键单击Web.config文件,并选择“编辑WCF配置”4。在“服务”文件夹下,选择weddingservice,然后在右侧窗格中单击Name属性的值。5.按下。。。按钮,然后导航到Bin目录并双击程序集dll。6.选择程序集后,选择(2*单击)实现Iweddingservice接口的类(weddingservice类)7。选择后,选择文件|保存,然后尝试帮助!我必须在RestService名称空间之前添加名称空间!它现在起作用了!伟大的谢谢您将其添加到哪个文件夹路径?
<service name="weddingservice">
<service name="RestService.weddingservice">
/bin/Debug/DemoWCF.dll
/bin/DemoWCF.dll