Q. 在c#中System.InvalidOperationException异常怎么处理?
System.InvalidOperationException:客户端发现响应内容类型为“text/plain”,但应为“text/xml”。请求失败,错误信息为:--...
System.InvalidOperationException: 客户端发现响应内容类型为“text/plain”,但应为“text/xml”。
请求失败,错误信息为:
--
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><WebServiceResponsexmlns="http://midplat.sinosoft.com"><WebServiceReturn><?xml version="1.0" encoding="UTF-8"?>
<TranData><RetData><Flag>1</Flag><DescCode>00</DescCode><Desc>交易成功</Desc><TranNo>110002053020150624000003F1</TranNo><OrderNo /><PayNo>635707423672530914</PayNo></RetData><LCCont><ContNo>2015E14000000003</ContNo><Status>02</Status><ProposalContNo>2015E14000000003</ProposalContNo><StateFlag>1</StateFlag><StatusDesc>承保有效</StatusDesc><EfftDate>2015-06-25</EfftDate><Prem>51.8</Prem><PolicyURL>http://www.kunlunhealth.com/templet/default/tmall_cl_bdxz.jsp?plcNo=2015E14000000003&key=553786688aea507e066e0075b4f846f9</PolicyURL></LCCont></TranData>
</WebServiceReturn></WebServiceResponse></soapenv:Body></soapenv:Envelope> 展开
请求失败,错误信息为:
--
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><WebServiceResponsexmlns="http://midplat.sinosoft.com"><WebServiceReturn><?xml version="1.0" encoding="UTF-8"?>
<TranData><RetData><Flag>1</Flag><DescCode>00</DescCode><Desc>交易成功</Desc><TranNo>110002053020150624000003F1</TranNo><OrderNo /><PayNo>635707423672530914</PayNo></RetData><LCCont><ContNo>2015E14000000003</ContNo><Status>02</Status><ProposalContNo>2015E14000000003</ProposalContNo><StateFlag>1</StateFlag><StatusDesc>承保有效</StatusDesc><EfftDate>2015-06-25</EfftDate><Prem>51.8</Prem><PolicyURL>http://www.kunlunhealth.com/templet/default/tmall_cl_bdxz.jsp?plcNo=2015E14000000003&key=553786688aea507e066e0075b4f846f9</PolicyURL></LCCont></TranData>
</WebServiceReturn></WebServiceResponse></soapenv:Body></soapenv:Envelope> 展开
展开全部
try
{
//连接端口
tcpClient.Connect(ip, port);
//连接成功时,关闭tcpClient,为下一轮扫描做准备
//tcpClient.Close();
//让tcpClient获得重生,可以无异常地进行下一轮扫描了
tcpClient = new System.Net.Sockets.TcpClient();
}
catch (System.Net.Sockets.SocketException ex)
{
}
{
//连接端口
tcpClient.Connect(ip, port);
//连接成功时,关闭tcpClient,为下一轮扫描做准备
//tcpClient.Close();
//让tcpClient获得重生,可以无异常地进行下一轮扫描了
tcpClient = new System.Net.Sockets.TcpClient();
}
catch (System.Net.Sockets.SocketException ex)
{
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询