IIS 使用WebServiceStudio.dll 报 "指定的参数已超出有效值的范围"错误

版权声明:随意乱写,切勿当真! https://blog.csdn.net/pehao/article/details/80432722

异常内容

   在 System.Windows.Forms.TreeNodeCollection.get_Item(Int32 index)
   在 WebServiceStudio.WebServiceHelper.GetMethodProperty(String methodName)
   在 WebServiceStudio.WebServiceHelper.InvokeWebMethod(String methodName, Object[] parameters)
...........................

在console程序中调用正常, 只有在iis中使用报错

排查方式

  1.  确保webservice地址可以使用 
  2.  确保调用Invoke方法得第一个参数 methodName没有问题
  3. c:\windows\temp文件夹 需要给IIS_IUSRS用户完全控制权限.
  4. 代码逻辑要判断初始化
            var ws = new WebServiceStudio.WebServiceHelper();
            var results = ws.InitWebservice("http://localhost:93/services/IntegrateServices.asmx");
            //判断初始化内容异常
            if (results == null || results.Count == 0)
            {
                throw new Exception("初始化异常");
            }

            try
            {
                ws.InvokeWebMethod("get", null);
            }
            catch (Exception ex)
            {
                              
            }

猜你喜欢

转载自blog.csdn.net/pehao/article/details/80432722