只找Java工作

胡说—八道。胡言-乱语。 但不骗你
正文

建立一个简单的WCF步骤 for WebForm

(2011-10-25 13:35:09) 下一个

一个简单的WCF for WebForm步骤 
1. create "WCF service Application"  project
2. create "Web Form" project
3. run WCF project ,get/copy address of WCF service
4. add services reference  to "Web Form" project 
5. add test code
6. set both project as start project(in solution) 

*.aspx
       
       

       
       

       
*.aspx.cs
        protected void Button1_Click(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client ser1 = new ServiceReference1.Service1Client();
            int i;
            bool b = int.TryParse(TextBox1.Text, out i);
            Label1.Text = ser1.GetData(i).ToString();
        }
*.svc.cs(service )
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }




 

[ 打印 ]
阅读 ()评论 (0)
评论
目前还没有任何评论
登录后才可评论.