IIS中的WCF双绑定主机

IIS中的WCF双绑定主机,iis,wcf,Iis,Wcf,我正在尝试在IIS中承载一个服务,该服务有2个方法。。。其中1个也可以通过简单的HTTP-GET请求访问 这是我的配置: <service name="Svc.PaymentService" behaviorConfiguration="DefaultBehavior"> <endpoint address="PaymentService.svc/" bindingName="Http" binding="ba

我正在尝试在IIS中承载一个服务,该服务有2个方法。。。其中1个也可以通过简单的HTTP-GET请求访问

这是我的配置:

  <service name="Svc.PaymentService" behaviorConfiguration="DefaultBehavior">
    <endpoint address="PaymentService.svc/"
              bindingName="Http"
              binding="basicHttpBinding"
              bindingConfiguration="httpBinding"
              contract="Svc.IPaymentService" />
    <endpoint address="WEBGETPaymentService.svc/"
              behaviorConfiguration="EndpointWebGetBehavior"
              binding="webHttpBinding" 
              contract="Svc.IPaymentService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost/MyService/" />
      </baseAddresses>
    </host>
  </service>
当我试图在IIS中托管服务并通过HTTP-GET请求调用它时,我总是收到404

无论如何,当我尝试通过PaymentService.svc调用SOAP方法时,它会工作

你知道错在哪里吗


谢谢

为了使用webHttpBinding,您需要在基于REST的*.svc文件中使用
WebServiceHost
(请参阅)

因此,您的WEBGETPaymentService.svc应该如下所示:

    [OperationContract]
    string SOAPMethod(
        string test);

    [OperationContract]
    [WebGet(UriTemplate = "asdf?test={test}")]
    string RESTfulMethod(
        string test);
<%@ ServiceHost Language="C#" Debug="True" 
    Service="Svc.PaymentService"
    Factory="System.ServiceModel.Activation.WebServiceHostFactory"  %>

因此,在这种情况下,它将使用
WebServiceHost
,并执行所有必要的操作,使REST在WCF中成为可能


另外,请查看MSDN上的,以了解有关如何托管和使用WCF REST服务的更多信息。

mhm,它没有解决我的问题。。现在我得到了一个“没有定义电子服务端点”,但我很确定这个定义是正确的…你使用什么URL?根据您的配置,它必须类似于
http://localhost/MyService/WEBGETPaymentService.svc/asdf?test=abc
-您是否缺少该URL的一部分??
<%@ ServiceHost Language="C#" Debug="True" 
    Service="Svc.PaymentService"
    Factory="System.ServiceModel.Activation.WebServiceHostFactory"  %>