WCF服务的创建和发布到IIS
2016-05-06 19:04
627 查看
一、 WCF服务的创建
有两种创建方式:
1.WCF服务库
2.WCF服务应用程序
如下图所示:
步骤3:
导入命名空间:
using WpfApplication1.WCFServerUseWCFLib;
调用WCF服务(这里调用方法 :
string GetData(int)
如果要客户端要使用异步编程,可以让客户端代理支持异步编程,做法是:
1.右键WCF服务的引用---选择“配置服务引用”。
2.在弹出的对话框中,勾选“生成异步操作”--点击“确定”按钮。
[b]四、解决方案
【The End】
http://www.cnblogs.com/easy5weikai/p/3341147.html
有两种创建方式:
1.WCF服务库
2.WCF服务应用程序
如下图所示:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <bindings> <wsHttpBinding> <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> <binding name="WSHttpBinding_IService11" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="http://127.0.0.1:7293/WCFServerUseWCFLib.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1" contract="WCFServerUseWCFLib.IService1" name="WCFServerUseWCFLibIService"> <identity> <servicePrincipalName value="host/weiMe-PC" /> </identity> </endpoint> <endpoint address="http://127.0.0.1:7294/WCFServerRefWCFLib.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService11" contract="WCFServerRefWCFLib.IService1" name="WCFServerRefWCFLibIService"> <identity> <servicePrincipalName value="host/weiMe-PC" /> </identity> </endpoint> </client> </system.serviceModel> </configuration>
步骤3:
导入命名空间:
using WpfApplication1.WCFServerUseWCFLib;
调用WCF服务(这里调用方法 :
string GetData(int)
private void BtnWCFLibToIIS_OnClick(object sender, RoutedEventArgs e) { using (WCFServerUseWCFLib.Service1Client proxy = new WCFServerUseWCFLib.Service1Client()) { MessageBox.Show(this.BtnWCFWebRefWCFLibTOIIS.Content.ToString() + proxy.GetData(2)); } }
如果要客户端要使用异步编程,可以让客户端代理支持异步编程,做法是:
1.右键WCF服务的引用---选择“配置服务引用”。
2.在弹出的对话框中,勾选“生成异步操作”--点击“确定”按钮。
[b]四、解决方案
【The End】
http://www.cnblogs.com/easy5weikai/p/3341147.html
相关文章推荐
- Android学习笔记:线性布局LinearLayout
- 微信发送永久图片素材接口----详解
- 显示毛玻璃效果图片
- Java判断当前用户数及当前登录用户数工具类-session原理
- /bin/bash^M: bad interpreter: No such file or directory
- Error from VB excel macro code - msxml3.dll -2146697211 The system cannot locate the resource specif
- 基于Netty的异步Rpc调用的小框架
- iOS 图片设置为圆角矩形,圆形等
- hdu 2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活 多重背包
- Spring MVC程序中得到静态资源文件css,js,图片 文件的路径
- uuid的生成
- HDU 3861 The King’s Problem 连通分量+二分匹配
- InfluxDB 入门安装教程
- Oracle_bond网卡配置
- HDU 4532
- JPA & Hibernate 注解
- vtk提取二维bmp图像某区域
- 盲点集锦
- ADO.NET——DataView
- Linux系统下Apache2.4.17的安装过程