首页 新闻 会员 周边

c# 奇怪问题HttpWebRequest

0
悬赏园豆:5 [已关闭问题] 关闭于 2013-05-05 14:51

 控制台程序项目 调用 web 应用程序中的 ashx

static void Main(string[] args)
        {
            HttpWebRequest webRequest = null;
            StreamReader responseReader = null;
            try
            {
                //ashx Url
                string getGscUserUrl = "http://localhost:10881/Handler.ashx";
                //加入参数,用于更新请求
                string urlHandler = getGscUserUrl + "?id=" + Guid.NewGuid();
                webRequest = (HttpWebRequest)HttpWebRequest.Create(urlHandler);
                webRequest.Timeout = 3000;//3秒超时
                //调用ashx,并取值
                responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());
                string currentUserGulid = responseReader.ReadToEnd();
                //return currentUserGulid.Trim();
            }
            catch
            {
                //return "";
            }

ashx中 :

 public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write("fuck your mother");

      }

无法调试到ashx中!!!并且抱500错误。。高手进。。咱回事!!!!

KeVinDurant的主页 KeVinDurant | 初学一级 | 园豆:5
提问于:2013-04-16 00:22
< >
分享
所有回答(2)
0

你可以在IE上浏览一下 http://localhost:10881/Handler.ashx 看看是不是也是这样

Yu | 园豆:12980 (专家六级) | 2013-04-16 08:32
0

你架设iis了没

格雷 | 园豆:166 (初学一级) | 2013-04-16 11:56
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册