自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

進行WCF Web Service創(chuàng)建與編寫

開發(fā) 后端
WCF Web Service有很多值得學習的地方,這里我們主要介紹WCF Web Service,在向大家詳細介紹XX之前,首先讓大家了解下什么是WCF Web Service

今天上導師的課,在里課堂里提到WCF Web Service創(chuàng)建者在設計此項技術(shù)時的一個基本原則:“服務具有自主性:服務及其客戶端同意它們之間的接口,但相互獨立。它們可以采用不同的語言編寫。#t#

可以使用不同的運行時環(huán)境(如   CLR   和   Java   虛擬機),可以運行在不同操作系統(tǒng)上,還可以存在其他方面的不同。”   我想這就說明   Indigo   的   Service   可以發(fā)布成一個標準的WCF Web Service ,客戶端可以是任意語言編寫的程序,只要它能通過WCF Web Service    的方式與其他程序交互。  

我做了以下嘗試:   

1.   用   WCF   寫一個   Service。

  1. <configuration       
  2.         xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">     
  3.       <system.serviceModel>     
  4.           <services>     
  5.                    
  6.               <service   name="WcfServer.MathService"     
  7.                                 behaviorConfiguration="MathServiceBehavior">     
  8.                   <host>     
  9.                       <baseAddresses>     
  10.                           <add   baseAddress="http://localhost:8000/MathService"/>     
  11.                       baseAddresses>     
  12.                   host>     
  13.                        
  14.                   <endpoint       
  15.                       address=""     
  16.                       binding="basicHttpBinding"     
  17.                       contract="WcfServer.IMath"/>     
  18.               service>     
  19.           services>     
  20.           <behaviors>     
  21.               <serviceBehaviors>     
  22.                   <behavior   name="MathServiceBehavior">     
  23.                       <serviceMetadata   httpGetEnabled="True"/>     
  24.                       <serviceDebug   includeExceptionDetailInFaults="False"   />     
  25.                   behavior>     
  26.               serviceBehaviors>     
  27.           behaviors>     
  28.       system.serviceModel>     
  29.   configuration>     
  30.       
  31.   2.   運行這個程序啟動   WCF   服務     
  32.       
  33.   3.   用   WSDL   工具生成一個代理類     
  34.       
  35.   在控制臺中輸入:wsdl   http://localhost:8000/MathService?wsdl     
  36.       
  37.   4.   創(chuàng)建一個客戶端工程,把生成的代理加入這個工程中:     
  38.       
  39.   namespace   UsingWebServiceMode     
  40.   {     
  41.           class   Program     
  42.           {     
  43.                   static   void   Main(string[]   args)     
  44.                   {     
  45.                           MathService   proxy   =   new   MathService();     
  46.                           int   result;     
  47.                           bool   resultSpecified;     
  48.                           proxy.Add(4,   true,   5,   true,   out   result,   out   resultSpecified);     
  49.                           Console.WriteLine(result);     
  50.                           Console.WriteLine(resultSpecified);     
  51.                           Console.ReadLine();     
  52.                   }     
  53.           }     
  54.   }     

我的最終目的是要讓 Java 寫的程序與WCF 技術(shù)實現(xiàn)的Service進行交互,要想讓 Java 的程序和.Net的程序交互,我想最好的方法就是WCF Web Service  。我寫的那些代碼就是想先試一下C# 的代碼能否用WCF Web Service 的方式與WCF技術(shù)實現(xiàn)的Service 進行交互,但現(xiàn)在的問題是我沒法精確控制這個WCF Web Service 的接口。

責任編輯:chenqingxiang 來源: 計世網(wǎng)
相關(guān)推薦

2009-12-08 18:14:53

WCF Service

2009-11-06 10:11:34

WCF和Web Ser

2009-12-08 11:34:40

WCF Windows

2009-08-11 13:27:22

C#創(chuàng)建Web Ser

2009-04-13 11:31:55

IBMdWWebService

2009-12-08 16:42:48

WCF Service

2009-12-07 18:33:31

WCF Service

2011-03-24 09:36:48

AzureWCF Service

2009-12-08 16:01:50

WCF Service

2011-04-28 15:18:59

2009-12-08 10:35:29

WCF地址

2021-09-08 14:47:53

UbuntuLinux服務

2019-11-23 15:45:38

Web指紋識別指紋

2009-11-06 13:59:09

WCF Service

2009-11-09 10:43:51

WCF Web編程模型

2011-10-27 16:24:48

API

2012-05-07 14:08:20

ApacheCXFJava

2009-12-07 18:47:16

WCF流

2009-12-08 18:31:58

WCF WEB

2009-12-08 17:08:13

WCF Service
點贊
收藏

51CTO技術(shù)棧公眾號