- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建我的第一个 WCF Restful 服务。在 VS2010 中,我打开 weddingservice.svc 然后按 F5。浏览器打开 http://localhost:50043/weddingservice.svc但是,这是我得到的错误:
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" %>
Iweddingservice.vb
Imports System.ServiceModel
Imports System.Web
Imports System.IO
Imports System.Runtime.Remoting.Activation
Imports System.Collections.Generic
Namespace RestService
<ServiceContract()>
Public Interface Iweddingservice
<OperationContract()> _
<Web.WebGet(UriTemplate:="job/{name}")> _
Function DoJob(name As String) As String
End Interface
End Namespace
weddingservice.svc.vb
Imports System.ServiceModel
Imports System.ServiceModel.Web
Imports System.IO
Imports System.ServiceModel.Activation
Imports System.Web.Script.Serialization
Imports System.Collections.Generic
Imports System.Xml
Imports System.Net
Namespace RestService
Public Class weddingservice
Implements Iweddingservice
Public Function DoJob(name As String) As String Implements Iweddingservice.DoJob
Return String.Format("Hello, {0}", name)
End Function
End Class
End Namespace
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" />
到
<serviceDebug includeExceptionDetailInFaults="true" />
为了得到更多的细节
并尝试再次运行该进程
关于asp.net - 找不到类型 'RestService.weddingservice',在 ServiceHost 指令中作为服务属性值提供,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9557221/
我正在做以下事情 //Define the service host this._smeediPluginServiceHost = new ServiceHost(typeof(S
我正在创建一个 WCF 服务,昨天它似乎在 VS 测试客户端上运行良好,但今天它似乎在我尝试更改 web.config 文件后抛出此错误。 下面是代码和配置文件: using System; usin
我有一个名为 WcfService2 的服务(我知道的原始服务),它有一个带有公共(public)接口(interface)的 IService.cs 文件: namespace WcfService
我在服务应用程序中有一个 ServiceHost,它每 60 秒与 1700 个客户端通信。当我启动该服务时,它几乎立即攀升到大约 1500 个打开的句柄,然后在大约 5 分钟后继续增加另外 300
使用单个合约运行 ServiceHost 工作正常,如下所示: servicehost = new ServiceHost(typeof(MyService1)); servicehost.AddSe
我有一个 WCF 服务库和一个 Windows 服务作为主机。我想让 ServiceHost 从任何目录而不只是从当前目录加载 WCF 服务库(从该程序集获取服务类型)。 最佳答案 一种方法是配置 -
我的服务器中运行着一个 WCF 服务,还有几个客户端在根据自定义 UserNamePasswordValidator 对自己进行身份验证后使用该服务,就像 http://burcakcakiroglu
我们有一个 WCF SerivceHost(自托管),在 App.config 中配置了 XML。主机已经打开。 我们想在运行时(通过代码)更改服务绑定(bind)中的特定配置值。 不幸的是,我们目前
好吧,我花了一天的时间查看这个错误和所有的帖子,但我似乎仍然找不到哪里出错了。我可以与来自外部 Web 服务客户端的 Web 服务通信,但我无法从 VS 或 IIS 中浏览 .svc 文件。我正在发布
我正在创建一个带有端口 0 的 WCF ServiceHost 以获得动态分配的端口: ServiceHost host = new ServiceHost(typeof(MyClass), new
由于我目前正在学习使用 WCF 服务,所以我经常在 Internet 上遇到教程,其中提到在使用 WCF 服务时使用 ServiceHost。 这个 ServiceHost 到底是什么? 在我当前的项
我在学习 WCF 教程时遇到以下错误。 HTTP 无法注册 URL http://+:8000/ServiceModelSamples/Service/ .您的进程没有访问此命名空间的权限(有关详细信
我正在尝试在 Windows 2007 SP1 服务器上将 WCF ServiceHost 作为 NT 服务运行。 ServiceHost 负责托管单个服务端点:具有以下地址的 basicHttpBi
这是一个与这个类似的问题: Win32Exception @ ServiceHost.Open() for WCF service . 我有一台机器在下面的 ServiceHost.Open 调用上非
我正在考虑自行托管我的 WCF 服务,而不是使用 IIS。对我来说,一个大问题是我是否需要像 IIS 那样实例化多个服务主机,或者一个就足够了。 除了隔离的安全原因之外,多个服务主机是否有任何好处?
我只是在整理我的一些 WCF(自托管)代码,并意识到我的 ServiceHost 对象在最初设置后超出了范围,但我仍然可以连接到它。 public void StartMyService() {
我正在开发一个简单的 wcf 服务进行测试。当我使用本地 IIS 7.5 测试此服务时,它可以正常工作。但是当我将其托管在 Web IIS 中时,我收到此错误: The type 'WcfServic
我可以使用 ServiceHost.AddServiceEndpoint 添加端点。如何获取端点列表? 最佳答案 使用host.Description.Endpoints 关于.net - WCF:如
在 svc 文件中设置 Debug="true"是否会降低性能?它是否足够重要,足以保证在生产环境中将其设置为“false”? %@ ServiceHost Language="C#" **Debug
这里有一个新成员。很高兴看到这样一个整洁的社区。 经过一番研究,我决定在我的应用程序中使用 WCF 进行进程间通信,因此我使用了 NetNamedPipeBinding 绑定(bind)。 Servi
我是一名优秀的程序员,十分优秀!