WCF 服务,作为服务属性值提供的类型...找不到 [英] WCF Service, the type provided as the service attribute values...could not be found

查看:22
本文介绍了WCF 服务,作为服务属性值提供的类型...找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很久以前就遇到过这个问题,只是想不起来如何解决它,或者可能是新问题.我创建了一个 WCF 服务,稍后我将在 Web 应用程序中使用该服务,该服务从远程位置调用 WCF 服务等.现在我试图在 IIS 中托管,甚至尝试过 WCFTestClient.尝试浏览服务时出现的错误;如下:

I have this issue a long time ago and just cannot recall how to resolve it or perphaps its something new. I created a WCF service which I will later use in web application that calls the WCF service amongst others from a remote location. Right now I am trying to host in IIS and even tried the WCFTestClient. The error I get when I try to browse to the service; is the following:

The type MyService.Service1 provided as the Service attribute 
value in the ServiceHost    directive, or provided in the 
configuration element system.serviceModel/serviceHostingEnvironment/
serviceActivations could not be found.

我认为它可能是我的 web.config 文件,但我看不出有什么问题:

I figured its probably my web.config file but I cannot see whats wrong:

<?xml version="1.0"?>
<configuration>

<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
  <webHttpBinding>
    <binding name="webHttpBinding" crossDomainScriptAccessEnabled="false" />
  </webHttpBinding>
</bindings>
<behaviors>
  <endpointBehaviors>
    <behavior name="web">
      <webHttp />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="webHttpBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="webHttpBehavior" name="WcfInstanceRules2.Service1">
    <endpoint address="" 
     binding="webHttpBinding" 
       contract="WcfRules2.IServiceS"     behaviorConfiguration="web"/>
    <endpoint address="mex" 
    binding="webHttpBinding" contract="IMetadataExchange"></endpoint>
  </service>
</services>

我希望这最终成为一个以 json 格式提供数据的休息服务.

I would like this to be eventually a rest service delivering data in json format.

推荐答案

检查您的 .svc 文件并查看它所引用的服务 - 可能是 MyService.Service1,它在您的配置中不存在.看起来它应该引用 WcfInstanceRules2.Service1.

Check your .svc file and see what service it's referencing - probably MyService.Service1, which doesn't exist in your config. It looks like it should be referencing WcfInstanceRules2.Service1.

这篇关于WCF 服务,作为服务属性值提供的类型...找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆