在WCF Restful Service中找不到端点

时间:2014-06-07 14:00:58

标签: c# wcf rest

我正在创建一个示例wcf服务,以便与我的一个客户端进行测试。 我使用SOAP获得结果,但REST无效。它显示" Endpoint Not Found"错误。 这是我的WCF服务的Web.Config。任何人都可以告诉我这个配置文件有什么问题。

 <?xml version="1.0"?>
 <configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
 </system.web>
 <system.serviceModel>
 <behaviors>
  <serviceBehaviors>
    <behavior name="web">
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="restbehavior">
    <webHttp/>
  </behavior>
</endpointBehaviors>
</behaviors>


<services>
  <service name ="s2HCloudService.Service1"
  behaviorConfiguration="web" >

    <endpoint name ="SOAPEndPoint"
    contract ="s2HCloudService.IService1"
    binding ="basicHttpBinding"
    address ="soap" />

    <endpoint name ="RESTEndPoint"
    contract ="s2HCloudService.IService1"
    binding ="webHttpBinding"
    address ="rest"
    behaviorConfiguration ="restbehavior"/>

    <endpoint contract="IMetadataExchange"
    binding="mexHttpBinding"
    address="mex" />
  </service>
</services>

<protocolMapping>
    <add binding="basicHttpsBinding" scheme="https" />
   </protocolMapping>    
   <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
  <modules runAllManagedModulesForAllRequests="true"/>
  <!--
    To browse web app root directory during debugging, set the value below to true.
    Set to false before deployment to avoid disclosing web app folder information.
-->
   <directoryBrowse enabled="true"/>
  </system.webServer>

 </configuration>

0 个答案:

没有答案