摘要: 安装SMTPServer后始终出现“The server response was: 5.7.1 Unable to relay for xxx@xxx.com"的错误,google后才发现必须更改缺省的Relay restrictions,即把127.0.0.1加入granted list。 阅读全文
posted @ 2011-02-14 17:28 Erich Wang 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 关于免注册COM的使用,Simplify App Deployment with ClickOnce and Registration-Free COM已经有了很详细的介绍。正如该文指出的,Windows会在CreateProcess的早期阶段根据*.exe.manifest创建一个内部表供将来CoCreateInstance使用。如果你无法控制exe.manifest,譬如你需要在Office ... 阅读全文
posted @ 2010-08-01 16:06 Erich Wang 阅读(1977) 评论(0) 推荐(1) 编辑
摘要: 一直以为签名project一定不能引用不签名的project,否则通不过编译的。其实在一种极端情况下:即签名的project A尽管reference不签名的project B,但是不直接使用任何project B的导出类,那么编译是可以通过的。在这种情况下,assembly A的metadata中并不包含B的任何信息,但是A可以通过Load,CreateInstance等方法动态实例化B中的类。... 阅读全文
posted @ 2010-05-24 22:53 Erich Wang 阅读(302) 评论(1) 推荐(1) 编辑
摘要: 从WinForm App中显示WPF窗口的代码:[代码]一般情况下,这都可以正常工作。但是如果在MyWindow的代码(不是XAML)中需要显示加载其他xaml文件(可能是资源文件):[代码]你在new MyWindow()就会得到NotSupportedException:"The URI prefix is not recognized". 有两种方法来解决这个问题:1.如果你有MyWindo... 阅读全文
posted @ 2009-03-29 13:27 Erich Wang 阅读(2332) 评论(0) 推荐(1) 编辑
摘要: [代码]1.managed resources和unmanaged resources的区别?通过.Net framework class使用的都是managed resource;unmanaged resource只有在你使用Win32 API才有可能得到2. 为什么需要显式释放managed resources?有时managed resources占用太多资源,需要尽早释放3.什么时候也需... 阅读全文
posted @ 2009-03-29 00:48 Erich Wang 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 先看下面一段代码(先以共享的方式打开文件读写,然后以只读的方式打开相同文件): FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite); FileStream fs2 = new FileStream(filePath, FileMode.Open, Fil... 阅读全文
posted @ 2008-12-11 21:23 Erich Wang 阅读(796) 评论(1) 推荐(1) 编辑