随笔分类 -  c#知识

vs2012出现无法启动iis express web 服务器的错误
摘要:一直用的好好的,今天调试时却总报上面的错误。“文件查看器”->"windows 日志"->"系统"里发现有几条“HttpEvent”错误,具体信息为“不能为 [::]:1708 绑定到下面的传输。IP 仅侦听列表可能包含到一个接口的引用,该接口在此计算机上不存在。数据字段包含错误号。”感觉像是提示端... 阅读全文
posted @ 2015-07-17 23:36 jenqz 阅读(327) 评论(0) 推荐(0)
httpwebrequest 用GET方法请求时报无法发送具有此谓词类型的内容正文
摘要:执行下面一段代码时,捕捉到异常:ProtocolViolationException HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Method = "get"; byte[] requestBytes = System.Text.Encoding.UTF8.GetBytes(data); request.ContentType = "application/x-www-form-urlencoded... 阅读全文
posted @ 2012-12-14 17:57 jenqz 阅读(5756) 评论(1) 推荐(1)
C#按字节截取字符串
摘要:一行包含汉字、字母、数字的文本,如:string txt = "一段C#代码值123元,你能接收吗?"; 如果我想把数字123截出来,直接使用txt.substring(12,3),实际截出的是“你能接”。所以可以考虑先转化为字节后再截取,代码如下: public class StringUtil { static string SubstringByte(string txt, int start, int length, string charset) { Encoding enc = Encoding.GetEncoding(... 阅读全文
posted @ 2012-12-14 17:47 jenqz 阅读(388) 评论(0) 推荐(0)
java调用.net webservice的完整实例
摘要:Java客户端调用Web Service的一般有以下三种方式:生成的stub、proxy(动态代理)以及dispatch(动态调用接口)。dispatch又分为payload和message两种方式。这个实例仅就dispatch的message方式进行介绍。C#代码using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Services;using System.Web.Services.Protocols;using System.Web.Service 阅读全文
posted @ 2012-12-10 00:33 jenqz 阅读(776) 评论(0) 推荐(0)