wcf服務是什么,WCF 安全性 之 None

 2023-10-14 阅读 26 评论 0

摘要:案例下載 http://download.csdn.net/detail/woxpp/4113172 服務端配置代碼 <system.serviceModel><services><service name="WcfServiceLibrary.ServiceTcp"><endpoint address="net.tcp://localhost:8731/WcfServiceLibrary"bi

案例下載

http://download.csdn.net/detail/woxpp/4113172

服務端配置代碼

  <system.serviceModel><services><service name="WcfServiceLibrary.ServiceTcp"><endpoint address="net.tcp://localhost:8731/WcfServiceLibrary"binding="netTcpBinding" bindingConfiguration="testnetTcpBinding"contract="WcfServiceLibrary.IServiceTcp"><identity><dns value="localhost" /></identity></endpoint><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /><host><baseAddresses><add baseAddress="http://localhost:8732/WcfServiceLibrary" /></baseAddresses></host></service></services><behaviors><serviceBehaviors><behavior><!-- 為避免泄漏元數據信息,請在部署前將以下值設置為 false 并刪除上面的元數據終結點  --><serviceMetadata httpGetEnabled="True"/><!-- 要接收故障異常詳細信息以進行調試,請將以下值設置為 true。在部署前設置為 false 以避免泄漏異常信息--><serviceDebug includeExceptionDetailInFaults="False" /></behavior></serviceBehaviors></behaviors><bindings><netTcpBinding><binding name="testnetTcpBinding"><security mode="None"></security></binding></netTcpBinding></bindings></system.serviceModel>

wcf服務是什么。客戶端調用代碼? 通過代理 代理生成 參見

http://www.cnblogs.com/woxpp/p/6232298.html

客戶端調用代碼?

    private void btnTest_Click(object sender, EventArgs e){NetTcpBinding netTcp = new NetTcpBinding();ChannelFactory<IServiceTcp> ftc = new ChannelFactory<IServiceTcp>();netTcp.Security.Mode = SecurityMode.None;IServiceTcp proxy = ChannelFactory<IServiceTcp>.CreateChannel(netTcp, new EndpointAddress("net.tcp://127.0.0.1:8731/WcfServiceLibrary"));txtMessage.Text = proxy.GetDataUsingDataContract(new WcfServiceLibrary.CompositeType() { StringValue = "sssss" }).StringValue;}

?

wcf干嘛用的。轉載于:https://www.cnblogs.com/woxpp/p/6232310.html

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/3/136413.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息