" CS0246:未找到命名空间"引用本地托管的WCF服务时出错

时间:2016-02-10 10:18:18

标签: c# asp.net .net wcf iis

我有一个在IIS 7本地托管的WCF服务,可以通过浏览器访问,也可以在IIS Express中运行时访问网站,在将同一网站部署到IIS时我会看到错误:

" CS0246:类型或命名空间名称' smsService'找不到(你错过了使用指令或汇编引用吗?)"

我遇到的所有内容都表明web.config文件中可能存在错误,所以我在下面列出了它们的内容。

非常感谢任何建议。

web服务:

<system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.net>
    <defaultProxy useDefaultCredentials="true">
    </defaultProxy>
  </system.net>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_smsServiceContract" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:82/smsService/smsService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_smsServiceContract"
        contract="smsService.smsServiceContract" name="BasicHttpBinding_smsServiceContract" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
    <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>

网站:

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_smsServiceContract" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:82/smsService/smsService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_smsServiceContract"
        contract="smsService.smsServiceContract" name="BasicHttpBinding_smsServiceContract" />
    </client>
  </system.serviceModel>
</configuration>

0 个答案:

没有答案