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

推荐订阅源

B
Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
B
Blog RSS Feed
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
Recent Announcements
Recent Announcements
A
About on SuperTechFans
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Google DeepMind News
Google DeepMind News
S
Schneier on Security
S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
Security Latest
Security Latest
Jina AI
Jina AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Recorded Future
Recorded Future
T
Tor Project blog
有赞技术团队
有赞技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News | PayPal Newsroom
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
Forbes - Security
Forbes - Security
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
C
Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Google DeepMind News
Google DeepMind News
Project Zero
Project Zero
IT之家
IT之家
T
Threatpost
Cyberwarzone
Cyberwarzone
O
OpenAI News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
J
Java Code Geeks
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
月光博客
月光博客
Latest news
Latest news
MongoDB | Blog
MongoDB | Blog
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - nect

【转】ie9 rc版软件兼容问题 [z]前端设计IE6/IE7/IE8/IE9/FF问题汇总:IE和FirFox兼容问题 - nect - 博客园 [z]ie和FF 在insertRow和insertCell的区别 [z]JS在IE和FF下attachEvent,addEventListener学习笔记 - nect - 博客园 WinForm使用webclient通过http的POST方式上传文件 转:另类解决:“ScriptManager”不是已知元素。原因可能是网站中存在编译错误。 - nect - 博客园 转:css妙用1-用图片替换文字 .net中的正则表达式(一)——转义字符 使用Cascadingdropdown控件遇到的一个问题 IP地址匹配算法 服务器控件的客户端验证脚本 从一个字符串中Remove另一个字符串 gridview 中模板列无法响应row_command事件 - nect - 博客园 【转】Prototype.js开发笔记//mark一下 在GridView中使用邮件链接 【转】ASP.net2。0中解决无法获取 GridView 隐藏列值问题 GridView 中格式化整理 [转]操纵自如--页面内的配合与通信 [导入]Java调用.net的WebService
在asp.net Atlas中调用 Web Service时无法找到自定义的Web Service对象的可能原因
nect · 2007-10-25 · via 博客园 - nect

今天看了Dflying Chen 的关于在ASP.NET Atlas种调用Web Service的文章,
对我们这些初学者确实起到不小的作用,但是文章中只注重的相对比较重要的内容,对一些细节问题没有进行强调,造成了很多网友在使用时都出现了Web Service对象无法找到的问题。
而且我开始模拟练习的时候也出现了这样的问题,为什么人家可以,我这里就不行了呢?
最终被我发现了问题的原因:

 1using System;
 2using System.Web;
 3using System.Collections;
 4using System.Web.Services;
 5using System.Web.Services.Protocols;
 6using System.Web.Script.Services;//必须加上这个引用,目的是在14行增加ScriptService属性
 7
 8
 9/// <summary>
10/// MyService 的摘要说明
11/// </summary>

12[WebService(Namespace = "http://tempuri.org/")]
13[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
14[ScriptService]//第6行引用后,再这里增加[ScriptService]属性,这样aspx页面就可以找到这个webservice了
15public class MyService : System.Web.Services.WebService {
16
17    public MyService () {
18
19        //如果使用设计的组件,请取消注释以下行 
20        //InitializeComponent(); 
21    }

22
23    [WebMethod]
24    public string Hello(string User) {
25        return "Hello " + User;
26    }

27    
28}

29
30


除此以外,在调用Web service的ASPX页面中,增加web service的引用时要注意.asmx文件和当前.aspx文件的路径。

        <asp:ScriptManager ID="ScriptManager1" runat="server">
            
<Services>
                
<asp:ServiceReference Path="MyService.asmx" /> <!-- 这里要注意.asmx文件和.aspx文件的相对路径-->
            
</Services>
        
</asp:ScriptManager>

不过我这里还有一个疑问:Dflying Chen  在介绍Javascript代码时直接使用了function "$()",但是没有进行明显的定义,我在使用的时候,这里也总是提示脚本错误,难道这个$()已经封装在所谓的Atlas.dll文件中了么?(我机器上好像没有这个文件。。。),高手请指点一下,先谢了,呵呵
遇到这个问题的朋友,可以在javascript增加function $()的定义,如下:

function $(s){return document.getElementById(s);}