隻找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)
評論
目前還沒有任何評論
登錄後才可評論.