开发者

Can't get WCF service's operations list with Web Service Studio client

开发者 https://www.devze.com 2023-02-05 19:23 出处:网络
I\'ve created a simple WCF service hosted by ASP.NET web site: [ServiceContract] public interface IPaymentNotificationReceiver

I've created a simple WCF service hosted by ASP.NET web site:

[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>

I can add references to this service as to WCF service, as to WebService. WcfTestClient application successfully recognized service and its methods.

But "Web Service Studio" (http://webservicestudio.codeplex.com/) can't get a list of operations... Why? How to diagnose/resolve that?

P.S. I work under VS 2008 using .NET 3.5


The problem was in endpoint binding configuration. To be accessible from WebService it should be 'basicHttpBinding'.

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


You probably have to give it the specific WSDL/MEX url, not just the url of the service. I imagine that VS.NET does some "sniffing" (checking your url + "?wsdl" or something of the sort) to try and find the endpoint, assuming it is exposed.

0

精彩评论

暂无评论...
验证码 换一张
取 消