在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
Webservice服务比较固定,至少有些服务比较固定,而且集中,这个时候谁也不喜欢动态的来来往往,这个时候只要修改下Web References文件夹下的Reference.cs,指定this.Url = “读取外部文件”,给个具体的代码吧
//获取外部TXT文件中的webservice地址
public static string GetUrl() { string _CodeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; _CodeBase = _CodeBase.Substring(8, _CodeBase.Length - 8); // 8是 file:// 的长度 string[] arrSection = _CodeBase.Split(new char[] { '/' }); string _FolderPath = ""; for (int i = 0; i < arrSection.Length - 1; i++) { _FolderPath += arrSection[i] + "/"; } string fileaddress = _FolderPath + @"\WorkFlowAddress.txt"; if (!File.Exists(fileaddress)) File.Create(fileaddress); StreamReader sr = new StreamReader(fileaddress); string str = sr.ReadToEnd().Trim(); sr.Close(); return str; }
//修改this.Url,其他的都不重要了,不管它们了
public FuctionForFlow() { this.Url = GetUrlClass.GetUrl(); //"http://192.168.2.16/SuperFormWS/WorkFlow/FuctionForFlow.asmx"; //global::EformWorkflow.Properties.Settings.Default.EformWorkflow_EformWeb_FuctionForFlow; if ((this.IsLocalFileSystemWebService(this.Url) == true)) { this.UseDefaultCredentials = true; this.useDefaultCredentialsSetExplicitly = false; } else { this.useDefaultCredentialsSetExplicitly = true; } } |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论