WCF(1)
?
- WCF:Windows Communication Fundation (windows 通讯接口).WCF本质上提供一个跨进程、跨机器以致跨网络的服务调用.WCF的服务不能孤立地存在,需要寄宿于一个运行着的进程中,我们把承载WCF服务的进程称为宿主,为服务指定宿主的过程称为服务寄宿(Service Hosting)。在我们的计算服务应用中,采用了两种服务寄宿方式:通过自我寄宿(Self-Hosting)的方式创建一个控制台应用作为服务的宿主(寄宿进程为Hosting.exe);通过IIS寄宿方式将服务寄宿于IIS中.WCF广泛采用基于自定义特性(Custom Attribtue)的声明式编程模式,我们通过在接口上应用System.ServiceModel.ServiceContractAttribute特性将一个接口定义成服务契约。WCF是一个基于消息的通信框架,采用基于终结点(Endpoint)的通信手段。终结点由地址(Address)、绑定(Binding)和契约(Contract)三要素组成,由于三要素应为首字母分别为ABC,所以就有了易于记忆的公式:Endpoint = ABC。每一个ASP.NET Web服务都具有一个.asmx文本文件,客户端通过访问.asmx文件实现对相应Web服务的调用。与之类似,每个WCF服务也具有一个对应的文本文件,其文件扩展名为.svc。如果要把服务挂载在iis上记得把Service 的属性的输出路径设置为bin,还有web.config文件的属性设置为copy always。
- Close all Visual Studio instances.
- Ensure that you are a member of the local debuggers group (Control Panel, Administrative Tools, Local Security Policy, Security Settings, Local Poliies, User Rights Assignment, Debug Programs).?
- Change the following registry key? HKCU\Software\Microsoft\VisualStudio\10.0\Debugger\DisableAttachSecurityWarning from 0 to 1.
- Restart Visual Studio.?
"The page you are requesting cannot be served because of the extension configuration...." 解决方法:i)Run Visual Studio 2008 Command Prompt as “Administrator”.Navigate to ii)C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation.iii)Run this command servicemodelreg i.
HTTP Error 403.14 - ForbiddenThe Web server is configured to not list the contents of this directory.
Solution -?
To resolve this problem, follow these steps:
i) Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.ii) In IIS Manager, expand server name, expand Web sites, and then click the Web site that you want to modify.In Features view, double-click Directory Browsing.iii) In the Actions pane, click Enable.
the solution of "Unable to automatically debug "***". the remote.........." is that: set the property"debug" of node "compilation" to "true" of web.config file of service. if can't slove the porblem, try to restart the vs.
The Web server is configured to not list the contents of this directory.
Solution -?
To resolve this problem, follow these steps:
i) Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.ii) In IIS Manager, expand server name, expand Web sites, and then click the Web site that you want to modify.In Features view, double-click Directory Browsing.iii) In the Actions pane, click Enable.
Solution -?
To resolve this problem, follow these steps:
i) Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.ii) In IIS Manager, expand server name, expand Web sites, and then click the Web site that you want to modify.In Features view, double-click Directory Browsing.iii) In the Actions pane, click Enable.
ii) In IIS Manager, expand server name, expand Web sites, and then click the Web site that you want to modify.In Features view, double-click Directory Browsing.iii) In the Actions pane, click Enable.
iii) In the Actions pane, click Enable.
Message:? Attaching to this process can potentially harm your computer.? If the information below looks suspicious or you are unsure, do not attach to this process.
The solution for me was just a few?steps...
很多刚刚接触WCF的人往往不能很好地区分Serialization和Encoding。我们的.NET Object通过Serialization转化成XML Infoset。但是要使我们的数据能够通过网络协议在网络上传递,必须把生成的XML Infoset转化成字节流(Byte Stream)。所以Encoding关注的是XML Infoset到字节流(Byte Stream)这一段转化的过程。在WCF中,有3中不同的方式可供选择:Binary;Text和MTOM(Message Transmit Optimized Mechanism)消息传输优化机制。Binary具有最好的Performance,Text具有最好的互操作性,MTOM则有利于大量数据的传送。
我们可以这样来理解Serialization和Encoding,Sterilization是基于Service Contract的——而实际上它也是定义在Service Contract中,是放在我们的Code中;而Encoding一般由Binding提供,它是和Service无关的,我们一般在Configuration中根据实际的需要选择我们合适的Encoding。WCF把Serialization和Encoding相互分离是有好处的,Serialization手部署环境的影响相对不大,具有相对的通用性,而Encoding则关系到访问Service的性能以及互操作性等方面,和部署环境紧密相关。比如对于一个在一个Intranet内部使用的系统,往往处于提高Performance考虑,我们一般是使用TCP Transport结合Binary 的Encoding,可能在某一天出现的来自于Internet的潜在的调用,我们不得不改用Http作为Transport,并使用Text Encoding。由于Encoding是可配置的,所以在这种情况下,我们只需要改变Configuration文件就可以了。
Wcf 中用到wshttpbinding和basichttpbinding的区别是:basichttpbinding发送的数据是不加密的,明文的;而wshttpbinding发送的时加密的数据;111111111111111111111111