| 发表于:2007-01-15 13:16:05 楼主 |
我初学webservice遇到了这样一个问题: webservice中: private static filestream m_f; [webmethod(description= "开始上传 ")] public bool beginupload(string filename,string path) { try { m_f = new filestream(path + "\\ " + filename, filemode.create); return true; } catch(exception ex) { return false; } } [webmethod(description= "分块上传 ")] public string uploadblock(byte[] fs,int length) { try { memorystream m = new memorystream(fs); m.writeto(m_f); m.close(); return " "; } catch(exception ex) { return ex.message; } } 主要是那个static,如果我不用static 的话,我调用下面一个函数uploadblock,m_f就会是null,为什么. client端我是这样写的: upload1 o = new upload1(); o.beginupload(filename,@ "d:\ "); for(int i=0;i <times;i++) { b = new byte[block]; fs.read(b,0,(int)block); string ret = o.uploadblock(b,block); //string a = o.uploadblock(b,block); } 以下是我自己的认为,应该是错的:是不是每次调用webservice就会把member对象重新负值一下? |
|
|
|
|