VS中调试Web Service

创建并发布WebService后,外部程序调用它时,有时想进到WebService源代码(Visual Studio)里面单步调试。
1.编写编译,并发布WebService服务

image

image

打开iis(Internet Information Services (IIS)管理器)右键网站-添加网站,打开目录浏览权限

image

2.开始调试

打开配置好的网站 以启动此网站的w3wp.exe进程

点击浏览,并访问asmx文件:

image

在VS中将WebService项目设置为启动项,在要调试的地方,设置断点。

点击调试菜单下附加到进程

image

可能会出现多个w3wp.exe 根据用户名选中配置调试项目的w3wp.exe进程 然后点击附加

image

附加后进行测试:

image

可以看到进入断点:

image

3.服务引用.net2.0

image

image

image

调用wcf:

public bool DocDelete(string username,string password,string docId, out string errorStr)
        {
            errorStr = string.Empty;

            //调用ELN服务
            //ElnWFService.WFService elnWFService = new ElnWFService.WFService();
            using (SRGWCF.WFService elnWFService = new SRGWCF.WFService())
            {

                bool status = elnWFService.DeleteExperiment(AppConfig.ElnServer,username,password, docId,out errorStr);
                if (!status)
                {
                    //errorStr += docId + "删除私人目录实验记录失败。";
                    return false;
                }

            }

            return true;
        }

完成

posted @ 2021-06-29 14:04  Ю詺菛╀時代  阅读(766)  评论(0编辑  收藏  举报