首页 新闻 会员 周边

WCF REST服务使用http协议部署到IIS上出错

0
悬赏园豆:10 [已解决问题] 解决于 2012-09-17 21:10

错误原因如下:

 

“/”应用程序中的服务器错误。

无法找到配置绑定扩展“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>

ttssrs的主页 ttssrs | 初学一级 | 园豆:82
提问于:2012-09-10 11:25
< >
分享
最佳答案
0

看看你的应用程序池是不是.net 4.0?

收获园豆:5
Launcher | 高人七级 |园豆:45045 | 2012-09-10 11:30

是4.0的,我发现是拼写错误, <endpoint address="http://192.168.1.100:8081/Wcf" binding="webhttpBinding" contract="WcfServiceCab.IService1" behaviorConfiguration="web"/>中的webhttpBinding改成webHttpBinding就对了。但是我还是不会部署rest服务,请问有没有rest的资料可以推荐呢?谢谢您的回答。

ttssrs | 园豆:82 (初学一级) | 2012-09-11 10:56

@ttssrs: 搜一下,很多:http://www.cnblogs.com/wuhong/archive/2011/01/13/1934492.html

rest部署最简单,在IIS中 address=http://192.168.1.100:8081/Wcf 都不用填写,你甚至可以用 StandEndpoint来简化部署。

Launcher | 园豆:45045 (高人七级) | 2012-09-11 11:12
其他回答(1)
0

webhttpBinding  有这个绑定吗 我记得有basichttpbinding ws。。。。。。。

收获园豆:5
chenping2008 | 园豆:9836 (大侠五级) | 2012-09-10 13:35

我发现是拼写错误, <endpoint address="http://192.168.1.100:8081/Wcf" binding="webhttpBinding" contract="WcfServiceCab.IService1" behaviorConfiguration="web"/>中的webhttpBinding改成webHttpBinding就对了。但是我还是不会部署rest服务,请问有没有rest的资料可以推荐呢?谢谢您的回答。

支持(0) 反对(0) ttssrs | 园豆:82 (初学一级) | 2012-09-11 10:57
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册