WCF服务......如何测试? [英] WCF Service ...how to test this?

查看:82
本文介绍了WCF服务......如何测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个WCF服务,我想知道为什么我创建的方法,即UploadDocument和getDocument没有出现在测试对话框中,有什么想法吗?



I created a WCF Service and I am wondering why the methods that I created i.e. UploadDocument and getDocument are not showing up within the test dialog, any ideas please?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace DocumentService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }

        public bool UploadDocument(Object document)
        {
            // 1. upload the document and save it to web server
            // 2. return successful as true, and, error message if there is an exception
            return true;
        }

        public Object getDocument(String searchFor)
        {
            //1. Search for the document
            //2. return flag indicating whether the search was successful.
            return true;
        }
    }
}





参考资料

1.安德鲁由Apress出版的Troelsen,Pro C#5.0和.NET 4.5 Framework



References
1. Andrew Troelsen, Pro C# 5.0 and the .NET 4.5 Framework, published by Apress

推荐答案

这篇关于WCF服务......如何测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆