WCF REST:WebHost无法处理请求

时间:2009-07-28 17:20:30

标签: wcf rest

我在负载均衡器后部署了一个WCF服务,当我尝试使用SOAP访问它时效果很好,但是当我尝试通过REST url访问它时,我得到了下面提到的错误。

这是我尝试使用https:// devreporting.dev.sample.com/ReportingManagement.svc/getAddtionsByCategory ..

尝试访问的REST URL

负载均衡器VIP为https:// devreporting.dev.sample.com,防火墙后面只有一台服务器,即dev01

我认为这是主机标题的一些问题,但不知道如何解决这个问题。任何想法都将不胜感激。

Message: WebHost failed to process a request. Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/12646224 
Exception: 

System.Web.HttpException: There was no channel actively listening at 'https://dev01.dev.sample.com:17005/ReportingManagement.svc/reporting/getAddtionsByCategory'. 
        This is often caused by an incorrect address URI. 
        Ensure that the address to which the message is sent matches an address on which a service is listening. ---> 
    System.ServiceModel.EndpointNotFoundException: There was no channel actively listening at 'https://dev01.dev.sample.com:17005/ReportingManagement.svc/reporting/getAddtionsByCategory'. 
            This is often caused by an incorrect address URI. 
            Ensure that the address to which the message is sent matches an address on which a service is listening.   
    at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)    
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
    --- End of inner exception stack trace ---    
    at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)   
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) 
    Process Name: w3wp Process ID: 4760

3 个答案:

答案 0 :(得分:11)

Phew ...我在我的部分中缺少安全配置,当我添加它时,事情就像魅力一样

   <webHttpBinding>
    <binding name="CommerceRESTBinding">
        <security mode="Transport">
                <transport clientCredentialType = "None" proxyCredentialType="None"/>
        </security>

</binding>
  </webHttpBinding>

答案 1 :(得分:0)

“没有主动收听的频道”听起来像它说的那样。在提出请求时,没有任何东西在侦听端口17005。

确保这是正确的网址。通过从服务器计算机上的命令提示符窗口发出以下命令来测试它:

telnet localhost 17005 输入
GET / 输入;注意:这不会回应
输入

如果这样做(从IIS连接并带回东西),则从负载均衡器远端的客户端计算机运行相同的测试。当然,在这种情况下,请使用完整的主机名而不是localhost

答案 2 :(得分:0)

<system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service name="Service" behaviorConfiguration="ServiceBehaviour">
        <endpoint address="" binding="webHttpBinding" behaviorConfiguration="webMyAcc" bindingConfiguration="TransportSecurity" contract="IService"/>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webMyAcc">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <client />`enter code here`
  </system.serviceModel>