惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - nikytwo

Install Tomcat 7 on CentOS, RHEL, or Fedora [转]如何安全的存储密码 打败 IE 的葵花宝典:CSS Bug Table 域名的DNS解析指南 IE6实现PNG图片透明 JQuery EasyUI 之 combobox plugin JQuery EasyUI 之 validatebox plugin JQuery easyUI 之 datebox plugin Asp.NET + OWC 输出Chart(图表) Route命令使用详解 CascadingDropDown Apache + PHP 安装日志 CSS图片垂直居中 - nikytwo - 博客园 CSS 条件缩放图片 SQL:行合并问题 & 使用 SP_executesql 从exec('SQL语句') 中得到一个返回值 Dataset.Readxml(stream) 错误 “缺少根元素” 分页 web Service 传输 Dataset (大数据量) Delphi 调用 Webservice (ASP.NET)
最近写 ASP.NET 中出现的错误 & 实现DataTable和DataSet类型的客户端/服务器端自动转换
nikytwo · 2009-05-15 · via 博客园 - nikytwo

CausesValidation 属性设置:未设置为 False 而导致 Ajax 回调时无反应,或设置了 True 而导致即使输入不合要求也提交后台处理(在无 Submit Button 情况下)

客户端调用 WebService ,其中 WebService 返回的是 DataSet 对象 :出现错误提示“WebMethod Dataset System.InvalidOperationException: A circular reference was detected......”

解决方法:

1. 在 WebService 方法前添加 [System.Web.Script.Services.ScriptMethod],如下:

1 [System.Web.Script.Services.ScriptMethod(ResponseFormat=System.Web.Script.Services.ResponseFormat.Xml)]
2 public DataSet GetData()
3 
4 }

不过这种方法返回的是 XML ,客户端调用 WebService 方法后,返回的是 XML 文档内容。

2.在 Web.Config 文件启用ASP.NET AJAX Futures CTP中自带的DataTable和DataSet相关JavaScriptConverter组件(参见:SP.NET AJAX异步调用Web Service和页面中的类方法 - 服务器端和客户端数据类型的自动转换(续4)),如下:

首先,确保项目引用了 Microsoft.Web.Preview.dll 程序集。(去http://go.microsoft.com/fwlink/?LinkID=77294下载"Microsoft ASP.NET AJAX

Futures CTP" 安装好后,在默认安装文件夹(C:"Program Files"Microsoft ASP.NET"ASP.NET 2.0 AJAX Futures January CTP"v1.0.61025)中可以找到.)ASP.NET AJAX Futures CTP:这一部分就是被ASP.NET AJAX暂时“抛弃”的原有CTP版本中“非核心”的部分,也叫做“Value-add”包,其中包括服务器端的扩展器控件(Extender Control)、Web部件,客户端的各种控件、拖放功能实现、ASP.NET AJAX XML脚本等。所谓“抛弃”,实际上只是意味着微软公司暂时不会对这些内容进行官方的支持,而选择使用“社区支持”的方法。这样,微软公司将不会为这部分 内容提供详细的开发文档,开发者只能在社区中互相讨论以找到问题的解决方案。若要安装这部分内容,则必须首先安装“核心”部分的ASP.NET 2.0 AJAX Extensions。(参见:ASP.NET Ajax程序设计—第I卷第2章第3节

添加引用后,则再 Web.config 文件中添加如下内容:

<system.web.extensions> 
<scripting> 
<webServices> 
<jsonSerialization> 
<converters> 
<add name="DataSetConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview"/> 
<add name="DataRowConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter, Microsoft.Web.Preview"/> 
<add name="DataTableConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter, Microsoft.Web.Preview"/> 
</converters> 
</jsonSerialization> 
</webServices> 
</scripting> 
</system.web.extensions>

 在添加上面的内容是,要先设置构架,如下:

<configSections>
    
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
          
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
          
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
        
</sectionGroup>
      
</sectionGroup>
    
</sectionGroup>
  
</configSections>

一切 ok~哈哈~