2011年8月3日
摘要: 通常我们在程序中需要调用WebService时,都是通过“添加Web引用”,让VS.NET环境来为我们生成服务代理,然后调用对应的Web服务。这样是使工作简单了,但是却和提供Web服务的URL、方法名、参数绑定在一起了,这是VS.NET自动为我们生成Web服务代理的限制。如果哪一天发布Web服务的URL改变了,则我们需要重新让VS.NET生成代理,并重新编译。在某些情况下,这可能是不能忍受的,我们需要动态调用WebService的能力。比如我们可以把Web服务的URL保存在配置文件中,这样,当服务URL改变时,只需要修改配置文件就可以了。 说了这么多,实际上我们要实现这样的功能: public 阅读全文
posted @ 2011-08-03 15:47 arong.NET 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1、错误的代码是: usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceWindowsFormsApplication5{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatestringblog=&quo 阅读全文
posted @ 2011-08-03 15:32 arong.NET 阅读(234) 评论(0) 推荐(0) 编辑
摘要: #region获取KeyValueConfigurationCollectionpublicstaticKeyValueConfigurationCollectionGetConfig(){try{System.Configuration.Configurationconfig=ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);KeyValueConfigurationCollectionsettings=config.AppSettings.Settings;returnsettings;}catch 阅读全文
posted @ 2011-08-03 15:29 arong.NET 阅读(211) 评论(0) 推荐(0) 编辑