我的web服务正在返回所有字符串变量。现在我想修改我的服务,以便它可以返回HashTable对象。这是我的WebService的入口点的签名(方法):如何从WebService返回一个HashTable?
public void getPrevAttempts(string fbUserId, string studentId, string assessmentId, out string isAuthenticated, out HashTable attempts)
在哈希表中的记录被插入形式的SQL查询的结果。每当我尝试运行我的服务时,我都会被重定向到accessdenied.htm页面(因为我的Web.config有这个条目<customErrors mode="On" defaultRedirect="accessdenied.htm"/>
)。有什么办法可以返回HashTable
或SQL查询的结果吗?
更新:
例外:The type System.Collections.Hashtable is not supported because it implements IDictionary.
什么是服务返回的错误反序列化? – Talha
'HashTable',90年代再次... – gdoron
我非常肯定'out'参数在Web服务签名中不受支持。你也可能会遇到序列化问题,特别是跨平台的问题(一个字符串是一个众所周知的类型,但是.Net Hashtable不是)。然而,一个Hashtable *被标记为可序列化的,所以我会尝试的第一件事就是使用它作为返回值。 –