WCF REST:WebHost 无法处理请求

5
我有一个WCF服务部署在负载均衡器后面,当我尝试使用SOAP访问它时,它可以正常工作,但是当我尝试通过REST URL访问它时,我会收到下面提到的错误。
这是我尝试用REST URL访问它的链接:https:// devreporting.dev.sample.com/ReportingManagement.svc/getAddtionsByCategory。
负载均衡器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

请问您能否解释一下SOAP URI和Rest URI之间的区别?您是不是指一个在Http上,另一个在Https上? - hussian
3个回答

12

呼...我在我的<section>中缺少安全配置,当我添加了它后,一切都像魔法般地正常工作了

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

</binding>
  </webHttpBinding>

这个应该放在哪里?你能把web.config中完整的代码片段发一下吗? - Robert Ivanc
非常感谢 - 你救了我一命! - Aaron D

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>

0

"没有活动监听的通道"听起来就像它所说的那样。在请求发出时,端口17005上没有任何东西在监听。

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

telnet localhost 17005 Enter
GET /Enter ;注意:这不会回显
Enter

如果这个命令有效(连接并从IIS带回一些内容),那么从负载均衡器另一侧的客户端机器上运行相同的测试。当然,在这种情况下,使用完整的主机名而不是localhost


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接