小编Ste*_*lom的帖子

无法为Web应用程序引用BCL.Async序列化任务`1

我们最近在测试域中部署了一个新开发的预编译服务,并收到以下错误:

Type 'System.Threading.Tasks.Task`1[Domain.Infrastructure.Contracts.Configuration.DomainServices]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types. 
Run Code Online (Sandbox Code Playgroud)

服务器是运行.NET 4.0的Windows 2008R2.

关于此问题有一些Stack Overflow问题,但大多数问题似乎都是指Async的CTP版本.显然,您必须在服务器上安装.NET 4.5才能使用此代码.

随着BCL.Async NuGet包的发布,这种情况是否发生了变化?

我的印象是,使用Async编译器编译并包含NuGet的BCL库的代码具有在.NET 4环境中运行所需的一切.

是否仍然需要将服务器上的.NET运行时升级到4.5?

编辑:提供堆栈跟踪:

[InvalidDataContractException: Type 'System.Threading.Tasks.Task`1[Domain.Infrastructure.Contracts.Configuration.DomainServices]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you …
Run Code Online (Sandbox Code Playgroud)

c# wcf asynchronous asp.net-mvc-3

2
推荐指数
1
解决办法
2544
查看次数

标签 统计

asp.net-mvc-3 ×1

asynchronous ×1

c# ×1

wcf ×1