我创建了一个由 ASP.NET 网站托管的简单 WCF 服务:
[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/) 无法获取操作列表...为什么?如何诊断/解决这个问题?
附注我在 VS 2008 下使用 .NET 3.5 工作
最佳答案
问题出在端点绑定(bind)配置中。要从 WebService 进行访问,它应该是“basicHttpBinding”。
<endpoint address=""
binding="basicHttpBinding"
contract="NotificationService.IPaymentNotificationReceiver"/>
关于.net - 无法使用Web Service Studio客户端获取WCF服务的操作列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4760353/