hxw

博客园 首页 新随笔 联系 订阅 管理
  10 Posts :: 0 Stories :: 45 Comments :: 0 Trackbacks

2010年7月10日 #

最近在学习WCF,返回datatable的时候老是出现“An error occurred while receiving the HTTP response to http://localhost:9999/calculatorservice. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.”的错误。检查了半天才发现原来是返回的datatable没有给tablename赋值。

 

代码
public System.Data.DataTable GetDataTable()
        {
            DataTable mydt 
= new DataTable();
            mydt.Columns.Add(
"UserID"typeof(int));
            mydt.Columns.Add(
"UserName"typeof(string));
            mydt.Columns.Add(
"Birthday"typeof(DateTime));
            
for (int i = 0; i < 300; i++)
            {
                DataRow dr 
= mydt.NewRow();
                dr[
"UserID"= i + 1;
                dr[
"UserName"= "xx" + i;
                dr[
"Birthday"= DateTime.Now;
                mydt.Rows.Add(dr);
            }
            
return mydt;
        }

 

 后来加上mydt.TableName="mydt";就好了。

posted @ 2010-07-10 14:07 redfox105 阅读(431) 评论(0) 编辑

2010年1月11日 #

.net cf:

C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5

sql ce3.5:

C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices

posted @ 2010-01-11 16:06 redfox105 阅读(349) 评论(0) 编辑

2009年1月5日 #

   最近因为发展需要,要在OA上集成即时通讯工具,本来打算用RTX或MSN的,但是没有相关源码,不好跟具体业务相结合,最后还是放弃了。也想找开源的,但是没找到.NET开发的具有服务端和客户端的,c++和java的倒是有,只可惜自己只对.net比较了解,没办法,只能自己开发了。

   在网上找了很多资料,决定实现一个基于XMPP协议的即使通讯工具,包括服务端和客户端。之所以采用XMPP协议,一是因为XMPP是标准的,二是因为有c#

开发的开源的类库可用。
  XMPP的前身是Jabber,一个开源形式组织产生的网络即时通信协议。XMPP目前被IETF国际标准组织完成了标准化工作。标准化的核心结果分为两部分;
  核心的XML流传输协议 rfc3920
  基于XML流传输的即时通讯扩展应用 rfc3921
  另外,XMPP Standards Foundation 也定义了许多其他的拓展规范。具体参见XMPP的官方网站:http://xmpp.org/ 这里有所有跟XMPPX相关的RFC

和XMPP拓展协议。上面也列有一些实现了该协议的部分软件,包括服务端和客户端。

  英文不好的人还可以查看

http://wiki.jabbercn.org/index.php/首页 这是xmpp的中文网站,翻译了主要的xmpp协议。

  目前.net平台上的xmpp开发库主要有:agsxmpp sdk IP*Works Internet Toolkit  jabber-net 等。
  建议使用agsxmpp 来开发。

  xmpp是基于xml来传输数据的。一般采用c/s 模式。客户端通过TCP连接客户端,而且是一直保持连接。目前也有HTTP的实现。

客户端和服务端通过xml流来交换信息。

下面是一段登录所传输的信息:(这是Spark的登录过程)

 C 代表客户端 S 代表服务端

 C:<stream:stream to="1" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

 S:<stream:stream from='hp520' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='a7747277-ad62-4813-b739-63504d6e1246' version='1.0' xml:lang='zh-cn'>

 S:<stream:features xmlns="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" /><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth" /><register xmlns="http://jabber.org/features/iq-register" /></stream:features>

C:<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>

S:<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />

C:<stream:stream to="hp520" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

S:<stream:stream from='hp520' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='a7747277-ad62-4813-b739-63504d6e1246' version='1.0' xml:lang='zh-cn'>
<stream:features xmlns="http://etherx.jabber.org/streams"><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth" /><register xmlns="http://jabber.org/features/iq-register" /></stream:features>

C:<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">AGh4dwAx</auth>

S:<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />

C:<stream:stream to="hp520" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

S:<stream:stream from='hp520' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='a7747277-ad62-4813-b739-63504d6e1246' version='1.0' xml:lang='zh-cn'>
<stream:features xmlns="http://etherx.jabber.org/streams"><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" /><session xmlns="urn:ietf:params:xml:ns:xmpp-session" /></stream:features>

C:<iq id="O193v-0" type="set"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>spark</resource></bind></iq>

S:<iq xmlns="jabber:client" id="O193v-0" type="result"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>spark</resource><jid>hxw@hp520/spark</jid></bind></iq>

C:<iq id="O193v-1" type="set"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>

S:<iq xmlns="jabber:client" id="O193v-1" type="result"><session xmlns="urn:ietf:params:xml:ns:xmpp-session" /></iq>

posted @ 2009-01-05 01:01 redfox105 阅读(5793) 评论(9) 编辑

2008年11月11日 #

摘要: wcf技术有关自定义拓展行为配置的一个BUG阅读全文
posted @ 2008-11-11 21:19 redfox105 阅读(1639) 评论(8) 编辑

2007年10月29日 #

winform 客户端通过WEB服务(采用WSE3.0,启用了MTOM)获取数据,偶尔会收到:"请求因 HTTP 状态 400 失败: Bad Request。"的错误返回,
同时发现服务器的事件日志里以下的错误:
HTTP/ASMX Message Receive Failure: System.Xml.XmlException: 根级别上的数据无效。 行 2,位置 1。
   在 System.Xml.XmlTextReaderImpl.Throw(Exception e)
   在 System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   在 System.Xml.XmlTextReaderImpl.Throw(String res)
   在 System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   在 System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   在 System.Xml.XmlTextReaderImpl.Read()
   在 System.Xml.XmlTextReader.Read()
   在 Microsoft.Web.Services3.Xml.XmlSkipDTDReader.Read()
   在 System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   在 System.Xml.XmlDocument.Load(XmlReader reader)
   在 Microsoft.Web.Services3.SoapEnvelope.Load(Stream inStream)
   在 Microsoft.Web.Services3.WseProtocol.CreateRequestSoapEnvelope(SoapServerMessage message)
   在 Microsoft.Web.Services3.WseProtocol.GetRequestEnvelopeFromMessage(SoapServerMessage message)
查找了很久都不知道是什么问题导致的,估计是启用了MTOM才会这样,不知道谁遇到过这种情况,帮忙看看.

我的WSE3.0配置:
<microsoft.web.services3 >
<messaging >
<mtom clientMode="On" serverMode="optional"/ >
</messaging >
<security >
<securityTokenManager >
<add type="TorchUsernameTokenManager" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken"/ >
</securityTokenManager >
</security >
<policy fileName="wse3policyCache.config"/ >
</microsoft.web.services3 >
posted @ 2007-10-29 01:44 redfox105 阅读(428) 评论(0) 编辑

2007年9月27日 #

摘要: 开发工具是VS2005,程序采用的技术架构是WSE3.0结合Web Service应用程序.NET2.0框架,WSE 3.0启用了MTOM,在某些客户机器上,每次启动客户端首次调用服务程序(客户端首次进行网络请求)时速度很慢(大约要20秒左右,其他正常机器只用1秒左右)。其他基本情况是:客户端程序是通过自动生成的代理调用,调用只返回一个序列化后的简单数据对像,不做过任何安全上的处理(全默认设置);...阅读全文
posted @ 2007-09-27 12:41 redfox105 阅读(322) 评论(0) 编辑

2007年4月20日 #

摘要: 地址:http://www.microsoft.com/china/MSDN/library/Mobility/pocketpc/bb278115.mspx?mfr=true阅读全文
posted @ 2007-04-20 14:10 redfox105 阅读(127) 评论(0) 编辑

摘要: 最近在做一个短信管理软件,需要把系统原有短信导入到新软件中,而.NETCF本身没有读取收件箱短信的类库,在网上搜寻了一下,发现只能通过操作MAPI来解决.幸运的是刚好找到了一个封装了MAPI的.NET类库.地址:http://www.codeproject.com/internet/CMapiEx.asp该类库是用于PC机的,要想用于wm平台还必须做一些修改,最后又参考了无聊客(http://bl...阅读全文
posted @ 2007-04-20 12:45 redfox105 阅读(2002) 评论(20) 编辑

2005年10月24日 #

摘要: 现在在学设计模式,参考书上和别人的程序,写了这个数据访问接口,采用了抽象工厂模式和简单工厂模式,权当练习之用,欢迎大家批评指正。目前支持OLEDB ODBC ORACLE SQLSERVER数据库,可以很容易的拓展支持其他的数据库。具体大家可以看看代码,当然只是供初学者学习用,高手就不必看了,呵呵。由于设计文档还没有完成,所以还没有放上去。以后会把完成的程序和设计文档一起放上来。/Files/hx...阅读全文
posted @ 2005-10-24 10:53 redfox105 阅读(761) 评论(3) 编辑

2005年9月11日 #

摘要: 1.根据ROWID来分select * from t_xiaoxi where rowid in(select rid from (select rownum rn,rid from(select rowid rid,cid from t_xiaoxi order by cid desc) where rownum<10000) where rn>9980) order by cid ...阅读全文
posted @ 2005-09-11 20:49 redfox105 阅读(5836) 评论(5) 编辑