2011-01-21 44 views
2

我创建了由ASP.NET网站托管一个简单的WCF服务:不能获得WCF服务的操作与Web服务Studio客户名单

[ServiceContract] 
public interface IPaymentNotificationReceiver 
{ 
    [OperationContract] 
    void InvoiceProcessed(string invoiceId); 
} 


public class PaymentNotificationReceiver : IPaymentNotificationReceiver 
{ 
    public void InvoiceProcessed(string invoiceId) 
    { 
     Logger.Write("'InvoiceProcessed' method was called with InvoiceId='" + 
      invoiceId + "'"); 
    } 
} 

<system.serviceModel> 
    <services> 
    <service 
     behaviorConfiguration = 
     "NotificationService.PaymentNotificationReceiverBehavior" 
     name="NotificationService.PaymentNotificationReceiver"> 
     <endpoint address="" binding="wsHttpBinding" 
     contract="NotificationService.IPaymentNotificationReceiver"> 
     <identity> 
      <dns value="localhost"/> 
     </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" 
      contract="IMetadataExchange"/> 
    </service> 
    </services> 
    <behaviors> 
    <serviceBehaviors> 
     <behavior name="NotificationService.PaymentNotificationReceiverBehavior"> 
     <!-- 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="true"/> 
     </behavior> 
    </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 

我可以对这个服务添加引用为WCF服务,就WebService而言。 WcfTestClient应用程序成功识别服务及其方法。

但是“Web Service Studio”(http://webservicestudio.codeplex.com/)无法获取操作列表...为什么?如何诊断/解决这个问题?

P.S.我使用.NET 3.5在VS 2008下工作。

回答

2

问题出在端点绑定配置。要从WebService访问它应该是'basicHttpBinding'。

<endpoint address="" 
      binding="basicHttpBinding" 
      contract="NotificationService.IPaymentNotificationReceiver"/> 
+0

你应该移动到这一点你的问题,或者接受这个作为答案,因此移动到顶部。 – casperOne 2011-01-21 19:48:36

1

您可能必须给它特定的WSDL/MEX url,而不仅仅是服务的url。我认为VS.NET会做一些“嗅探”(检查你的url +“?wsdl”或类似的东西),试图找到端点,假设它被暴露。

+0

我试着后缀既干净服务地址和地址“WSDL?” - 既没有工作 – Budda 2011-01-21 17:19:48