WCF服务,无法找到作为服务属性值...提供的类型

问题描述 投票:0回答:1

我很久以前就遇到过这个问题而且无法回想起如何解决这个问题或者说它是新的东西。我创建了一个WCF服务,稍后我将在Web应用程序中使用该服务从远程位置调用WCF服务。现在我正在尝试在IIS中托管甚至尝试过WCFTestClient。我尝试浏览服务时遇到的错误;如下:

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文件,但我看不出什么错:

<?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格式提供数据的休息服务。

visual-studio-2010 wcf
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.