18stream69,17ream

http://www.itjxue.com  2023-01-24 04:45  来源:未知  点击次数: 

system net webexception操作超时怎么办

et(客户端)调用IIS(服务端)出现503后,就报操作超时错误

问题描述:

服务端环境:

IIS

客户端环境:

windowsxp + iis + .net

调用时出现如下错误:

System.Net.WebException: 远程服务器返回错误: (503) 服务器不可用。

在 System.Net.HttpWebRequest.GetResponse()

在 TestWebRequest.WebMessage.SendRequest(Byte[] data, String urlStr)

接着就出现如下错误:

System.Net.WebException: 操作超时

在 System.Net.HttpWebRequest.GetRequestStream()

最后一直是这个错误

System.Net.WebException: 操作超时

在 System.Net.HttpWebRequest.GetRequestStream()

当服务器恢复正常时,访问已经是200时,这个线程还是返回操作超时,经过N多测试,最后如下一行完美解决:

myRequest.ServicePoint.Expect100Continue = false;

public byte[] SendRequest(byte[] data, string urlStr)

2 {

3 try

4 {

5 Stream streamSend = null;

6 HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(urlStr);

7 myRequest.Method = "POST";

8 myRequest.ContentType = "text/xml";

9 myRequest.Accept = "*/*";

10 myRequest.Timeout = 2000;

11 myRequest.UserAgent = "Mozilla-Firefox-Spider(Wenanry)";

12 myRequest.ContentLength = data.Length;

13 //这个在Post的时候,一定要加上,如果服务器返回错误,他还会继续再去请求,不会使用之前的错误数据,做返回数据

14 myRequest.ServicePoint.Expect100Continue = false;

15

16 HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);

17 myRequest.CachePolicy = noCachePolicy;

18

19 try

20 {

21 streamSend = myRequest.GetRequestStream();

22 streamSend.Write(data, 0, data.Length);

23 streamSend.Close();

24 }

25 catch (WebException wex)

26 {

27 log.Debug("WebException=" + wex.ToString() + ",wex.Status=" + wex.Status);

28 if (streamSend != null)

29 streamSend.Close();

30 streamSend = null;

31 myRequest = null;

32 return null;

33 }

34 catch (Exception ex)

35 {

36 log.Debug("GetRequestStream=" + ex.ToString());

37 if (streamSend != null)

38 streamSend.Close();

39 myRequest = null;

40 return null;

41 }

42

43 byte[] byteArr = new byte[256];

44 Stream streamRequest = null;

45 try

46 {

47 streamRequest = myRequest.GetResponse().GetResponseStream();

48 }

49 catch (Exception httpex)

50 {

51 log.Debug("SendRequest=" + httpex.ToString());

52 if (streamRequest != null)

53 streamRequest.Close();

54 myRequest = null;

55 return null;

56 }

57 Bytes bytes = new Bytes();

58 int count = streamRequest.Read(byteArr, 0, 256);

59 while (count 0)

60 {

61 bytes.writeByteArr(Bytes.byteSub(byteArr, 0, count));

62 count = streamRequest.Read(byteArr, 0, 256);

63 }

64 streamRequest.Close();

65 return bytes.getByte;

66 }

67 catch (Exception eee)

68 {

69 log.Debug("eee=" + eee.ToString() + eee.Source + eee.StackTrace);

70 }

71 return null;

72 }

http://streamrdt.music.qq.com/8982.7acd2d03d5c01722c9ffc08b5c83499a/0/a.mp3请问这是什么歌曲的链接。

姚婷 - 双人面具

试听

五点半的机车

俄和俄的行囊

机票握在手上

泪水却涌出眼眶

迩说迩会来送俄

俄想迩会留下俄

谁能让暮色

停在这1刻

俄穿过3环4环一路飞奔

俄看见迩站在暗间的大门

迩孤单的身影藏不住

迩眼中那忧伤光芒

接下来俄就拉着迩的手

(接下来他就拉着俄的手)

捧着迩的脸(捧着俄的脸)

擦去迩的泪(擦去俄的泪)YE~~~

放弃的念头

俄从来都没有

俄需要迩的爱

请迩不要走

给俄一个留下来的理由

留下来陪俄

陪迩度过每个春夏秋冬

在陌生天空飞翔

一个人的旅途中

谁为迩愁肠

我从别人的QQ空间克隆了歌只是地址为什么地址连接不上? 求高人帮忙

你要找到那歌的名字然后自己在QQ空间背景上传才可以他的地址连接是从网络连接到他QQ的又不是你的

http://streamrdt.music.qq.com/1369.7ea68978ce69e8ceac959c2a419ae222/101741836/a.mp3

My Girl (Scenziato Dj's Remix)

这是百度的搜索结果:

;tn=baidump3ct=134217728lf=rn=word=My+Girl+%28Scenziato+Dj%27s+Remix%29lm=-1

这是土豆网的:

这里有歌词和翻译:

Everytime I see your lovely body

I wanna hold you close into my arms

Everytime I look into your brown eyes baby

I really don't know what I'm gonna do

Everytime I look into the mirror

I can feel you right here next to me

I keep thinking if you really want me baby

And if I'm really good enough for you

so, baby

If you wanna stay with me, now

I'll be right here waiting for you

If you wanna live with me, now

I'll be right here waiting for you

Fly away together, going on forever

All the way I'll be there, only cause of you

Always be together from now and till forever

You're the one I want, my only fantasy

每次看到你美丽动人的身影,就想把你搂在怀里;

每次看着你棕色的眼睛,就不知所措;

每次看着镜子,就能感觉到你在身旁;

我一直在想,你是否真的需要我,我对你够不够好;

因此,宝贝

如果你现在想跟我在一起,我会在这里一直等着你;

如果你现在想跟我在一起,我会在这里一直等着你;

一起远走高飞,直到永远;

只要有你的地方,无论如何我都会相随;

一直在一起,从现在起直到永远;

你是我的唯一,我唯一的梦想。

ftp输入mode active 出现we only support stream mode,sorry什么意思

tp输入mode active 出现we only support stream mode,sorry什么意思

publicclassBinarySearchDemo{publicstaticvoidmain(String[]args){int[]a=newint[]{1,5,7,9,11,18,23,48,69};intpoint=newBinarySearchDemo().binarySearch(a,23);if(point==-1)System.out.println("在数组中未查找到数23");elseSystem.out.println("数字23是数组中第"+(point+1)+"位数");}/***二分法查找一个整数在整型数组中的位置**算法思路:首先得到数组a的最小值和最大值的下标,分别是:low和high,接着求出值位于数组中间那个数的下标middle*然后再将这个middle对应的数组中的数和待查找的数num进行比较,如果相等,则表示已查找到,如果num

(责任编辑:IT教学网)

更多

相关XML/XSLT文章

推荐XML/XSLT文章