WCF分布式开发常见错误(4):The type or namespace name 'DataContract' could not be found DataContract找不到
来源:互联网 发布:java注解类 编辑:程序博客网 时间:2024/06/06 02:29
我们进行WCF项目开发,自己定义数据契约的时候会出现这样的错误:
DataContract、DataMember、DataMemberAttribute找不到,如图:
The type or namespace name 'DataContract' could not be found (are you missing a using directive or an assembly reference?) E:/CodesVs2008/WCFServiceIISHostFrankXuLei/WcfServiceLib/WcfServiceLib/IService1.cs 24 6 WcfServiceLib
The type or namespace name 'DataMember' could not be found (are you missing a using directive or an assembly reference?) E:/CodesVs2008/WCFServiceIISHostFrankXuLei/WcfServiceLib/WcfServiceLib/IService1.cs 30 10 WcfServiceLib
The type or namespace name 'DataMemberAttribute' could not be found (are you missing a using directive or an assembly reference?) E:/CodesVs2008/WCFServiceIISHostFrankXuLei/WcfServiceLib/WcfServiceLib/IService1.cs 30 10 WcfServiceLib
解决办法,在项目里添加System.Runtime.Serialization程序集的引用。
生命引用程序集:
using System.Runtime.Serialization;
编译即可成功。
【老徐的博客】
【作者】:Frank Xu Lei
【地址】:http://www.cnblogs.com/frank_xl/archive/2009/03/16/1413752.html
- WCF分布式开发常见错误(4):The type or namespace name 'DataContract' could not be found DataContract找不到
- Unity发布时出现“The type or namespace name `UnityEditor' could not be found.” 错误
- The type or namespace name 'AjaxControlToolkit' could not be found in the global namespace
- MSbuild failure: error CS0246: The type or namespace name 'DataLoader_Accessor' could not be found
- The type or namespace name 'DbContext' could not be found-vs2012
- Unity发布时出现“The type or namespace name `UnityEditor' could not be found.”
- The type or namespace name `MovieTexture' could not be found. Are you missing an assembly reference?
- The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an asse
- The type or namespace name '***' could not be found (are you missing a using directive or an asse
- Unity使用FXMaker导致发布时报“The type or namespace name `UnityEditor' could not be found” 解决备忘
- 解决The type or namespace name \'XXXX\' does not exist in the namespace \'XXXXXXXXX\' 的错误
- WCF分布式开发常见错误(23):This could be due to the fact that the server certificate is not configured properly with HTTP.SYS
- WCF - DataContract 继承
- WCF-省略DataContract标记
- WCF DataContract and DataMember
- WCF-省略DataContract标记
- WCF分布式开发常见错误(24):Could not establish trust relationship for the SSL/TLS secure channel with authority
- The type or namespace name 'Windows' does not exist in the class or namespace 'System'
- WCF分布式开发步步为赢(3)WCF服务元数据交换、配置及编程开发
- WCF分布式开发常见错误解决(6)Service 'WcfServiceApp.WCFService' has zero application
- WCF分布式开发步步为赢(2)自定义托管宿主WCF解决方案开发配置过程详解
- Ubuntu常用命令列表
- WCF分布式开发常见错误(5)Could not find a base address that matches scheme
- WCF分布式开发常见错误(4):The type or namespace name 'DataContract' could not be found DataContract找不到
- c3p0与dbcp 数据源配置方式
- WCF分布式开发步步为赢(1):WCF分布式框架基础概念
- WCF分布式开发常见错误(3):客户端调用服务出错:You have tried to create a channel to a service that does not support .Net Framing
- WCF分布式开发常见错误(2)无法从传输连接中读取数据: 远程主机强迫关闭了一个现有的连接。。
- WCF分布式开发常见错误解决(1):An error occurred while attempting to find services at...添加服务引用出错
- 开发常见错误解决(7)连接到SQL Server 2005出错
- WSE3.0构建Web服务安全(4):MTOM消息传输优化和文件上传、下载
- Visual Studio 集成开发工具学习(2)Visual Studio 2008快捷键大全