新聞中心
如果WCF配置為空,那么endpoint的地址就是默認(rèn)的基地址(Base Address)。例如WCF配置的地址就是http://localhost/servicemodelsamples/service.svc,而IMetadataExchange服務(wù)的地址則為http://localhost/servicemodelsamples/service.svc/mex。這里所謂的基地址可以在

海南州網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,海南州網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為海南州上1000+提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站制作要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的海南州做網(wǎng)站的公司定做!
- name="Microsoft.ServiceModel.Samples.CalculatorService"
- behaviorConfiguration="CalculatorServiceBehavior">
baseAddress= - "http://localhost/ServiceModelSamples/service.svc"/>
… />
當(dāng)我們?cè)诙x一個(gè)實(shí)現(xiàn)了Service Contract的類時(shí), binding和address信息是客戶端必須知道的,否則無(wú)法調(diào)用該服務(wù)。然而,如果需要指定服務(wù)在執(zhí)行方面的相關(guān)特性時(shí),就必須定義服務(wù)的behavior。在WCF中,定義behavior就可以設(shè)置服務(wù)的運(yùn)行時(shí)屬性,甚至于通過(guò)自定義behavior插入一些自定義類型。例如通過(guò)指定ServiceMetadataBehavior,可以使WCF服務(wù)對(duì)外公布Metadata。WCF配置如下:
name="metadataSupport"> httpGetEnabled="true" httpGetUrl=""/>
在WCF配置中,behavior被定義為Attribute,其中,System.ServiceModel.ServiceBehaviorAttribute和System.ServiceModel.OperationBehaviorAttribute是最常用的behavior。雖然,behavior作為Attribute可以通過(guò)編程的方式直接施加到服務(wù)上,但出于靈活性的考慮,將behavior定義到WCF配置文件中才是***的設(shè)計(jì)方式。#t#
利用ServiceBehavior與OperationBehavior可以控制服務(wù)的如下屬性:
name="metadataSupport"> httpGetEnabled="true" httpGetUrl=""/>
網(wǎng)站標(biāo)題:剖析WCF配置全過(guò)程
當(dāng)前路徑:http://m.5511xx.com/article/cooijoo.html


咨詢
建站咨詢
