错误原因如下:
“/”应用程序中的服务器错误。
无法找到配置绑定扩展“system.serviceModel/bindings/webhttpBinding”。请验证此绑定扩展是否已在 system.serviceModel/extensions/bindingExtensions 中正确注册以及是否拼写正确。
下面是我的配置文件:
<?xml version="1.0"?><configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="WcfServiceCab.svcBehavior">
<!-- 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>
<security mode="Transport"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="WcfServiceCab.IService1" behaviorConfiguration="WcfServiceCab.svcBehavior">
<endpoint address="http://192.168.1.100:8081/Wcf" binding="webhttpBinding" contract="WcfServiceCab.IService1" behaviorConfiguration="web"/>
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
看看你的应用程序池是不是.net 4.0?
是4.0的,我发现是拼写错误, <endpoint address="http://192.168.1.100:8081/Wcf" binding="webhttpBinding" contract="WcfServiceCab.IService1" behaviorConfiguration="web"/>中的webhttpBinding改成webHttpBinding就对了。但是我还是不会部署rest服务,请问有没有rest的资料可以推荐呢?谢谢您的回答。
@ttssrs: 搜一下,很多:http://www.cnblogs.com/wuhong/archive/2011/01/13/1934492.html
rest部署最简单,在IIS中 address=http://192.168.1.100:8081/Wcf 都不用填写,你甚至可以用 StandEndpoint来简化部署。
webhttpBinding 有这个绑定吗 我记得有basichttpbinding ws。。。。。。。
我发现是拼写错误, <endpoint address="http://192.168.1.100:8081/Wcf" binding="webhttpBinding" contract="WcfServiceCab.IService1" behaviorConfiguration="web"/>中的webhttpBinding改成webHttpBinding就对了。但是我还是不会部署rest服务,请问有没有rest的资料可以推荐呢?谢谢您的回答。