C# wcf服务中出现错误

C# wcf服务中出现错误,c#,wcf,C#,Wcf,我正在使用wcf服务向我的客户提供一些数据以绘制图表。我看到了一些东西并创建了该服务,但当我运行它时,它显示以下错误。如何克服它? 类型“WcfService2.Servi”,在ServiceHost指令中作为服务属性值提供,或在配置元素系统中提供。找不到serviceModel/serviceHostingEnvironment/serviceActivations 这是我的web.config文件 <?xml version="1.0"?> <configuration&g

我正在使用wcf服务向我的客户提供一些数据以绘制图表。我看到了一些东西并创建了该服务,但当我运行它时,它显示以下错误。如何克服它?
类型“WcfService2.Servi”,在
ServiceHost
指令中作为服务属性值提供,或在配置元素
系统中提供。找不到serviceModel/serviceHostingEnvironment/serviceActivations

这是我的web.config文件

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

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>

    <services>

      <service name="WcfService2.Servi" behaviorConfiguration="WcfService1.Service1Behavior">
        <!-- Service Endpoints -->
        <endpoint address="" binding="webHttpBinding" contract="WcfService2.Servi" behaviorConfiguration="web" bindingConfiguration="crossDomain">

          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfService1.Service1Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp/>
        </behavior>

      </endpointBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding name="crossDomain" crossDomainScriptAccessEnabled="true" />
      </webHttpBinding>

    </bindings>

  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>


您的服务合同类型称为
WcfService2.Servi
。这看起来像是打字错误。如果你纠正了这一点,服务是否有效?

对不起,steve,我已经发布了。你现在能理解这个问题吗?这里仍然没有问题。哦,没关系,我再次编辑了它。你能检查一下吗。我在这里提到了我的错误。您的服务合同类型真的叫做
WcfService2.Servi