GeneralCalculatorService.svc代码:
<%@ ServiceHost Language="C#" Debug="true" Service="Services.GeneralCalculatorService" %>web.config配置:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="calculatorServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Services.GeneralCalculatorService" behaviorConfiguration="calculatorServiceBehavior">
<endpoint binding="basicHttpBinding" contract="Contracts.ServiceContract.IGeneralCalculator"/>
</service>
</services>
</system.serviceModel>
<system.web>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
</configuration>
代码入上,在.net4.0中,运行http://localhost/WCFServices/GeneralCalculatorService.svc ,
报错:
The type 'Services.GeneralCalculatorService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.请各位指教,非常感谢!!!
<%@ ServiceHost Language="C#" Debug="true" Service="Services.GeneralCalculatorService" %>web.config配置:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="calculatorServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Services.GeneralCalculatorService" behaviorConfiguration="calculatorServiceBehavior">
<endpoint binding="basicHttpBinding" contract="Contracts.ServiceContract.IGeneralCalculator"/>
</service>
</services>
</system.serviceModel>
<system.web>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
</configuration>
代码入上,在.net4.0中,运行http://localhost/WCFServices/GeneralCalculatorService.svc ,
报错:
The type 'Services.GeneralCalculatorService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.请各位指教,非常感谢!!!
解决方案 »
- 谁有asp.net伪静态Demo!
- asp.net中如何实现dropdownlist的onselectedindexchanged的类似方法
- Oracle 10 下的“System.Exception: System.Data.OracleClient requires Oracle client s
- 为什么编译完asp.net,放到网上去,第一次访问时有个数值从数据库里面查不出来!!!
- 很简单的sql考验
- 我想对一段文字中关键字加亮,比如一出现‘plglenn’,就图一个背景色块,如何实现的
- 郁闷中!兄弟们给点建议,急!!!
- 请问我的sql server链接用户是哪个?回答即给分
- asp.net 加javascript的src的问题
- 自已写的table函数,为什么不能实现。
- 求类化个php语句。。(到asp.net
- 我想做一个电影院订票系统,该有哪些表呢?
<endpoint binding="basicHttpBinding" contract="Contracts.ServiceContract.IGeneralCalculator"/>
</service>
name="Services.GeneralCalculatorService"
没识别到这个
{
public class GeneralCalculatorService : IGeneralCalculator
{
public double Add(double x, double y)
{
return x + y;
}
}
}上面是服务类定义,请高人指教,该如何做才能运行成功!!!