扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:朱先忠编译 来源:天极开发 2007年11月4日
关键字:
<span class="pf">Class="MyService" |
<span class="pf">Class="TransactableTemperatures</span>" |
<?xml version="1.0"?> <configuration xmlns= "http://schemas.microsoft.com/.NetConfiguration/v2.0"> <system.serviceModel> <services> <service type="TransactableTemperatures"> <endpoint contract="ITransactableTemperatures" binding="wsHttpBinding" bindingConfiguration="Binding1"/> </service > </services > <bindings> |
<wsHttpBinding> <binding configurationName="Binding1" transactionFlow="true" /> </wsHttpBinding> </bindings> </system.serviceModel> <system.web> <compilation debug="true"> <assemblies> <add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> </compilation> </system.web> </configuration> |
![]() 图2.运行服务-该图显示出示例事务性服务从一个浏览器中运行的结果。 |
![]() 图3.设计客户-该图显示出Visual Studio表单设计器中的Windows表单客户应用程序。 |
<?xml version="1.0" encoding="utf-8" ?> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <system.serviceModel> <client> <endpoint configurationName="default" address= "http://atlas/TransactableService/Service.svc/" binding="wsHttpBinding" bindingConfiguration="Binding1" contract="ITransactableTemperatures"/> </client> <bindings> <wsHttpBinding> <binding configurationName="Binding1" transactionFlow="true" /> </wsHttpBinding> </bindings> </system.serviceModel> </configuration> |
private void btnConvert_Click(object sender, EventArgs e){ using(TransactableTemperaturesProxy theProxy = new TransactableTemperaturesProxy("default")) { TransactionOptions transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel =IsolationLevel.ReadCommitted; using ( TransactionScope tx = new TransactionScope( TransactionScopeOption.RequiresNew,transactionOptions)) { double d = Convert.ToDouble(txtIn.Text); double dResult = 0.0D; if (rbCToF.Checked) dResult = theProxy.ctof(d); else dResult = theProxy.ftoc(d); lblOut.Text = dResult.ToString(); tx.Complete(); } } } |
婵犵鈧啿鈧綊鎮樻径鎰畺闁靛ň鏅滄慨婊堟偨椤栨稓鎽冮柟鐑╂櫊瀹曟岸宕堕埡鍌滄殸闂佽鍨伴崢鏍姳閿涘嫭鍠嗘い銈呭姬婵☆偅婢樺Λ妤呮偂濞嗘挸瀚夐柍褜鍓熷顒侊紣娓氣偓閻涙捇鏌涘┑鍛樂缂佹鐭傞獮搴ㄥ焵椤掑嫬瀚夋い鏍ㄧ懁缁诲棝鏌熼褍鐏茬紒杈ㄧ箞閺屽洭鏁愰崟顓犳澖闁荤姳闄嶉崹钘壩i崟顖涘殜闁硅泛顫曢埀顒€锕︾槐鏃堝箣閻愬弬妤呮煛閸偄鐏﹂柛瀣墬缁傛帞鎹勯搹瑙勵啈闂佸搫瀚烽崹閬嶅磻瀹ュ鍎嶉柛鏇ㄥ墯娴犳ê霉閿濆棗鈻曢柍褜鍓氶弻銊ф閻愬鈻曢悗锝傛櫇椤忛亶鏌曢崱顓熷
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者